命令提示符:运行 PowerShell 时访问被拒绝

Command Prompt: access denied when run PowerShell

我在尝试从命令行 运行 powershell 时遇到问题。当弹出 window 以蓝色背景显示时,我输入了 powershell.exe:"This app cant run on your PC, to find version for your PC check publisher"。然后命令提示符给出消息:"Access is denied."

如有任何建议,我们将不胜感激。

我的问题是 C:/windows/system32/powershell.exe 无效,如下图所示:

我可以在 C:\Windows\System32\WindowsPowerShell\v1.0\ 中找到正确的可执行文件。

因此,如果这是您的问题,请尝试以下操作:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe .\my-script.ps1

而不是这个:

powershell.exe .\my-script.ps1