如何在 powershell 脚本中使用 wmic 卸载 Microsoft Visual C++ 2022

问题描述 投票:0回答:1

我尝试使用以下代码在 powershell 脚本中卸载 Microsoft Visual C++ 2022:

但没有附加内容(除了错误,例如:没有可用的实例)。

但是当我使用命令时:product where name="Microsoft Visual C++ 2022 X64 Minimum Runtime" call uninstall;在带有 wmic 的 powershell 中,它正在工作。

你有什么想法吗?

powershell visual-c++ wmic
1个回答
0
投票

您可以使用 Get-WmiObject.

$Program = Get-WmiObject -Class Win32_Product -Filter "name='Microsoft Visual C++ 2022 X64 Minimum Runtime'"
$Program.Uninstall()
© www.soinside.com 2019 - 2024. All rights reserved.