无法加载文件 xxx\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本。

无法加载文件 C:\Users\lenovo\Documents\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 3 ‘C:\Users\lenovo\Documents\WindowsPowerShell\profile.ps1’

管理员权限启动powershell执行该命令即可,然后将终端重新启动,报错就消失了

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

如果发现重启电脑后又出现了同样的问题,可以管理员权限启动powershell,执行该命令,这样会把配置写入注册表,直到下次重新修改配置才会变更

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`

参考文档:https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1


版权声明:本文为z_dmsd原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。