天天看點

無法加載檔案 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