[英]Unable to execute PowerShell Script
How can I get my PowerShell script to execute? 如何使我的PowerShell脚本执行?
When I run my script I get the error: 运行脚本时出现错误:
File cannot be loaded because the execution of scripts is disabled on this system
Can you help me to get my script to run? 您能帮我运行我的脚本吗?
set-executionpolicy unrestricted
#Set-ExecutionPolicy RemoteSigned
$target=[IO.File]::ReadAllText(".\usermenuTest1.4d")
$output=[IO.File]::ReadAllText(".\usermenuTest2.4d")
($output -replace $target) | Set-Content "usermenuTest2.4d.new"
Start-Sleep -s 10
This Technet article suggests trying Get-ExecutionPolicy
to check your script execution policy, and then set it to AllSigned
or Unrestricted
. Technet上的这篇文章建议尝试使用Get-ExecutionPolicy
来检查脚本执行策略,然后将其设置为AllSigned
或Unrestricted
。 Also, make sure you run the script like this ".\\scriptname.ps1"
另外,请确保您像这样运行脚本".\\scriptname.ps1"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.