powershell ExecutionPolicy设置不正确



我正在从批处理脚本运行powershell。这是示例代码。

powershell.exe Set-ExecutionPolicy Bypass -Force
set logDir=C:testfolder
mkdir %logDir%
powershell.exe C:<folder>test.ps1 >> "%logDir%test.log"

获取错误:"test.ps1";未被识别为cmdlet的名称此问题仅发生在特定的VM上。在其他windows机器上执行相同的脚本。需要解决此问题。

每当我想要powershell.exe执行ps1文件时,我都会使用以下语法:

powershell.exe -f "C:<folder>test.ps1"

告诉exe执行一个文件而不是Cmdlet。

最新更新