在 PowerShell 中验证环境时,如果出现“因为在此系统上禁止运行脚本”的红色报错,应该输入什...
Criado em: 25 de agosto de 2026
Respondido usando GPT-5.6 Thinking por Chat01
Criado em: 25 de agosto de 2026
Respondido usando GPT-5.6 Thinking por Chat01
在 PowerShell 中验证环境时,如果出现“因为在此系统上禁止运行脚本”的红色报错,应该输入什么命令来解决?
选项 A
sudo chmod +x script.ps1
选项 B
set-ExecutionPolicy RemoteSigned
选项 C
npm config set scripts-prepend-node-path true
选项 D
Format-Volume -DriveLetter C
答案是 选项 B:Set-ExecutionPolicy RemoteSigned。
它用于调整 PowerShell 的脚本执行策略,允许本地脚本运行,同时要求从互联网下载的脚本经过签名。