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

hac*_*ife 5 powershell command-prompt

尝试从命令行运行 powershell 时遇到问题。当弹出窗口显示为蓝色背景时,我输入了 powershell.exe 说:“此应用程序无法在您的 PC 上运行,以查找适用于您的 PC 检查发布者的版本”。然后命令提示符给出消息:“访问被拒绝。”

任何建议将不胜感激。

fab*_*tto 3

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

在此输入图像描述

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

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

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe .\my-script.ps1
Run Code Online (Sandbox Code Playgroud)

而不是这个:

powershell.exe .\my-script.ps1
Run Code Online (Sandbox Code Playgroud)