使用cmd执行ps1失败
封装系统时遇到的问题,在cmd中使用 powershell.exe -file a.ps1执行PowerShell脚本,路径正确但报错。

执行get-executionpolicy,如果结果是 Restricted,表示当前禁止执行脚本。
执行set-executionpolicy -executionpolicy unrestricted按Y允许即可.
封装系统时遇到的问题,在cmd中使用 powershell.exe -file a.ps1执行PowerShell脚本,路径正确但报错。

执行get-executionpolicy,如果结果是 Restricted,表示当前禁止执行脚本。
执行set-executionpolicy -executionpolicy unrestricted按Y允许即可.