在 PowerShell 中验证环境时,如果出现“因为在此系统上禁止运行脚本”的红色报错,应该输入什...

Erstellt am: 25. August 2026

Beantwortet mit GPT-5.6 Thinking von Chat01

Frage

在 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

Gedanke

Worked for a second

Antwort

答案是 选项 B:Set-ExecutionPolicy RemoteSigned

它用于调整 PowerShell 的脚本执行策略,允许本地脚本运行,同时要求从互联网下载的脚本经过签名。

Diesen Q&A teilen