有没有一种干净的方法来卸载MS Word知识库文章使用批处理/ PowerShell命令?
背景:
我一直在尝试卸载one KB文章(KB4475558) MS Word 2013。作为手动团队解决方案的一部分,谁想卸载所有新安装的知识库文章。我成功地尝试安装了多个知识库文章。但卸载一直都很棘手。
到目前为止,
方法1:wusa /uninstall /KB:4475558 wusa.exe /uninstall /kb:4475558 /norestart /quiet -它显示“此操作仅对当前已安装的产品有效”错误。
方法2:使用GUID
Msiexec /I {90150000-006E-0401-1000-0000000FF1CE} MSIPATCHREMOVE={80BC2A33-0ADF-4731-AC75-046BA9B6B7AF} /qb -它显示“此操作仅对当前已安装的产品有效”错误。
方法3:
通过下面的链接使用Microsoft.Update.Searcher,
PowerShell: How to find and uninstall a MS Office Update
--不起作用。
你能在这些问题上帮助我吗:
1:我已经手动安装了那些知识库文章,我可以手动卸载它:但是通过脚本,它显示了上面的错误。为甚麽呢?
他说:还有其他我可能遗漏的方法吗?
注: MS Office没有安装,只安装了MS word和共享点,并且我的机器中没有可用的Trail版本。我也试过重启机器一次,但没有效果。
任何帮助都是非常有帮助的!谢谢
发布于 2020-02-11 02:46:41
您是否尝试过使用batch-file解析注册表卸载项中的卸载字符串?我通常不会推荐这种方法,但它可能总比没有强。
@(For /F "Delims=" %%G In (
'^""%__AppDir__%reg.exe" Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "(KB4475558)" /D 2^>NUL^|Find "{"^"'
)Do @For /F "Tokens=2*" %%H In ('^""%__AppDir__%reg.exe" Query "%%G" /V "UninstallString" 2^>NUL^"')Do @Echo(%%I)&Pause如果您对结果感到满意,您可以修改代码以尝试卸载它(很可能需要以管理员身份运行脚本或命令)。
从batch-file
@For /F "Delims=" %%G In (
'^""%__AppDir__%reg.exe" Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "(KB4475558)" /D 2^>NUL^|Find "{"^"'
)Do @For /F "Tokens=2*" %%H In ('^""%__AppDir__%reg.exe" Query "%%G" /V "UninstallString" 2^>NUL^"')Do @%%I或来自cmd
For /F "Delims=" %G In ('""%__AppDir__%reg.exe" Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "KB4475558" /D 2>NUL|Find "{""')Do @For /F "Tokens=2*" %H In ('""%__AppDir__%reg.exe" Query "%G" /V "UninstallString" 2>NUL"')Do @Echo(%I如果您尝试对您的office产品的所有KB更新执行此操作,则类似以下内容可能会让您更接近:
@(For /F "Delims=" %%G In (
'^""%__AppDir__%reg.exe" Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "0FF1CE}_Office" /K 2^>NUL^|Find "{"^"'
)Do @For /F "Tokens=2*" %%H In ('^""%__AppDir__%reg.exe" Query "%%G" /V "UninstallString" 2^>NUL^"')Do @Echo(%%I)&Pause如果您对结果感到满意,您可以修改代码以尝试卸载它(很可能需要以管理员身份运行脚本或命令)。
从batch-file
@(For /F "Delims=" %%G In (
'^""%__AppDir__%reg.exe" Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "0FF1CE}_Office" /K 2^>NUL^|Find "{"^"'
)Do @For /F "Tokens=2*" %%H In ('^""%__AppDir__%reg.exe" Query "%%G" /V "UninstallString" 2^>NUL^"')Do @Echo(%%I)&Pause或来自cmd
For /F "Delims=" %G In ('""%__AppDir__%reg.exe" Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /S /F "0FF1CE}_Office" /K 2>NUL|Find "{""')Do @For /F "Tokens=2*" %H In ('""%__AppDir__%reg.exe" Query "%G" /V "UninstallString" 2>NUL"')Do @%I请注意,以上示例仅解析注册表项HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall__。可能还有其他位置,例如HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall也有您需要的信息。
https://stackoverflow.com/questions/60143620
复制相似问题