最近遇到了一個需求 要用cmd或powershell做出一個可以快速切換UAC status的需求 我這邊google的結果 採用了 https://gallery.technet.microsoft.com/How-to-switch-UAC-level-0ac3ea11 這個咚咚 但是他仍需要手動啟動powershell後 到指定路徑 import之後才能用 那為甚麼不直接進控制台直接調整呢? 所以我寫出了一個batch跟一個ps1可以快速呼叫該腳本 不囉嗦 上code: [pra01.ps1] Set-ExecutionPolicy Bypass Set-ExecutionPolicy Unrestricted echo "[0]Never notIfy" echo " " echo "[1]NotIfy me only when apps try to make changes to my computer(do not dim my desktop)" echo " " echo "[2]NotIfy me only when apps try to make changes to my computer(default)" echo " " echo "[3]Always notIfy" echo " " echo "pleace enter level:" $qaq=Read-host Import-Module ./SwitchUACLevel.psm1 Set-UACLevel $qaq [main.bat] @echo off xcopy /y /q %~dp0SwitchUACLevel.psm1 C:\Windows\System32\ xcopy /y /q %~dp0pra01.ps1 C:\Windows\System32\ cls Powershell.exe -File pra01.ps1 pause del C:\Windows\System32\pra01.ps1 /f del C:\Windows\System32\SwitchU...