You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Choco Uninstall覆盖Package参数卸载软件时注册表键匹配失败

卸载Newforma时Chocolatey无法识别自定义softwareName参数的问题

问题详情

尝试卸载Newforma软件,Chocolatey无法定位正确的注册表卸载键。执行命令choco uninstall -d newforma --override --params '/softwareName:Newforma*'尝试覆盖softwareName参数,但调试输出显示系统仍在查找硬编码的newforma12.1*注册表键,最终提示软件已通过其他方式卸载。

完整调试输出

Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1' -installArguments '' -packageParameters '/softwareName:Newforma*' -overrideArgs']
Host version is 5.1.19041.1, PowerShell Version is '5.1.19041.5129' and CLR Version is '4.0.30319.42000'.
---------------------------Script Execution---------------------------
Running 'ChocolateyScriptRunner' for newforma v12.2.3.12933 with packageScript 'C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1', packageFolder:'C:\ProgramData\chocolatey\lib\newforma', installArguments: '', packageParameters: '/softwareName:Newforma*',
Running 'C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1'
Running Get-UninstallRegistryKey -softwareName 'newforma12.1*'
Registry uninstall keys on system: 67
Error handling check: 'Get-ItemProperty' fails if a registry key is encoded incorrectly.
WARNING: No registry key found based on  'newforma12.1*'
Found 0 uninstall registry key(s) with SoftwareName:'newforma12.1*'
WARNING: newforma has already been uninstalled by other means.

解决方法

1. 检查并修改卸载脚本

打开C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1,查看脚本是否正确读取packageParameters中的softwareName参数。如果脚本中硬编码了newforma12.1*,将其替换为可接收参数的逻辑,或者直接修改为正确的匹配字符串Newforma*后重新执行卸载命令。

2. 手动卸载+清理Chocolatey记录

  • 通过Windows设置/控制面板的「应用和功能」找到Newforma并手动卸载
  • 执行命令强制清理Chocolatey中的包记录:
    choco uninstall newforma --force
    
  • 删除Chocolatey残留的包目录:C:\ProgramData\chocolatey\lib\newforma

3. 直接通过注册表卸载

  • 打开PowerShell,运行以下命令查找Newforma的注册表卸载键:
    Get-ChildItem -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall, HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall | Where-Object { $_.GetValue("DisplayName") -match "Newforma" }
    
  • 获取对应的UninstallString值,直接执行该字符串完成卸载(例如如果是MSI包,格式通常为msiexec /x {产品GUID})

内容的提问来源于stack exchange,提问作者dnvn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 23:43:29