0
我创建了PowerShell脚本来从子文件夹获取文件。这时候执行我后手动输入Set-ExecutionPolicy unrestricted
从PowerShell控制台运行,但是当我打电话相同的脚本从批处理文件在从批处理文件调用powershell脚本时执行策略错误,powershell v 1.0
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe D:\programs\abc\bin\xyz_clean.ps1
它抛出一个错误:
xyz_clean.ps1 cannot be loaded because the execution of scripts is disabled on this system.
你在运行什么操作系统(包括32位和64位)? – alroc 2013-03-05 15:20:45
您是否试过在批处理中指定执行策略? 'C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ PowerShell.exe -executionpolicy unrestricted -file D:\ programs \ abc \ bin \ xyz_clean.ps1' 除此之外,您的“每位用户“和”机器“执行策略,你可以尝试使用你缺少-file选项的set-executionpolicy – Poorkenny 2013-03-05 15:22:57
的'-scope'参数。 PowerShell脚本是否被组策略拒绝? – 2013-03-05 15:23:58