PowerShell 腳本 (.ps1) 常需管理員權限修復系統問題(如 Win10 應用程式異常)。為右鍵選單加入「以系統管理員身分執行」,免去先開 PowerShell 再拖曳腳本的麻煩。
regedit → HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell。runas。HasLUAShield(值留空),顯示 UAC 盾牌圖示。runas 下新建鍵值 command。command 預設值為:powershell.exe "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"右鍵任意 .ps1 檔案即見「以系統管理員身分執行」,點選自動提權執行。恢復預設只需刪除 runas 鍵值。文末提供 .reg 檔下載雙擊即用。