How to toggling UAC on/off quickly, eg. using command line, in Windows-7?

Run the following commands with Administrator privileges:

  • Disable UAC

    %windir%\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
    
  • Enable UAC

    %windir%\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f
    

Ready for me to blow your minds with a hidden "feature"...

To disable UAC for all subsiquent commands in the same session--i.e. if you close the particular script or CMD sessions it resets and you just have to set it again to disable temporarily:

SET __COMPAT_LAYER=WINXPSP3


As an aside - If you are a computer administrator, and you still want to keep UAC for standard users, there’s an easy way to turn it off for administrators only.

Just open Local Security Policy from Administrative Tools in the Control Panel.

Then go to Local Policies > Security Options.

Scroll all the way down and find where it says something like: USER ACCOUNT CONTROL: Behavior of elevation prompt for administrators in Admin. Approval Mode;

Double-click it and then click the drop down list and change it to “elevate without prompting.”

UAC should no longer annoy administrators.