Powershell脚本右键添加已管理员身份运行

将下列注册表文件导入到系统中即可

Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas]
"HasLUAShield"=""
 
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas\command]
@="powershell.exe \"-Command\" \"if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\""

Was this article helpful?

Related Articles