如何在批处理文件中运行Powershell CheckNetIsolation命令

时间:2020-03-04 15:45:54

标签: powershell command-line

我需要从命令行运行https://docs.microsoft.com/en-us/office/troubleshoot/error-messages/cannot-open-add-in-from-localhost中提到的以下Powershell命令:

CheckNetIsolation LoopbackExempt -a -n="microsoft.win32webviewhost_cw5n1h2txyewy"

尽管它可以在PowerShell上运行,但不能在命令行上使用。这是我尝试的命令:

powershell.exe -command "& {CheckNetIsolation LoopbackExempt -a -n=microsoft.win32webviewhost_cw5n1h2txyewy}"

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

链接中提到的powershell命令不是特定于powershell的命令。只要以管理员身份运行DOS框,就可以在常规DOS命令行上按原样运行它。