将命令解析为 Powershell(引号)

Parsing command to Powershell (quotation marks)

我正在尝试 运行 命令提示符下的此命令,但由于引号的缘故,它不起作用。我尝试了各种替代方案,但现在卡住了。

powershell -command "Get-AppxPackage -AllUsers | where-object {$_.name -notlike "*store*"} | Remove-AppxPackage"

真的很想得到一些建议。 非常感谢。

可以使用 \

转义名称过滤器周围的引号
powershell -command "Get-AppxPackage -AllUsers | where-object {$_.name -notlike \"*store*\"} | Remove-AppxPackage"

行可以粘贴到批处理脚本 (.bat) 中,或者只是从命令提示符 运行 粘贴。

可以使用撇号而不是引号。

powershell -command "Get-AppxPackage -AllUsers | where-object {$_.name -notlike '*store*' } | Remove-AppxPackage"

请注意大写字母不是用来喊叫的。它们是 Unicode 字符名称。 https://www.unicode.org/charts/PDF/U0000.pdf