How to Add an "Open Command Prompt Here As Administrator" Shortcut to the Context Menu in Windows 7 and Windows Vista
To add an "Open Command Prompt Here as Administrator" shortcut to the context menu in Windows 7 and Windows Vista, follow these steps:
1. Click on the Start menu and type "regedit" in the search box. Press Enter to open the Registry Editor.
2. Navigate to the following key: HKEY_CLASSES_ROOT\Directory\shell
3. Right-click on the "shell" key and select New > Key. Name the new key "runas".
4. Right-click on the "runas" key and select New > Key. Name the new key "command".
5. Double-click on the "Default" value in the "command" key and enter the following value: cmd.exe /k pushd %L && start cmd.exe /k "title Command Prompt (Admin) && color 0a && echo Administrator Command Prompt at %CD% && echo. && prompt $g && set __COMPAT_LAYER=RunAsInvoker"
6. Close the Registry Editor.
Now, when you right-click on a folder while holding down the Shift key, you should see the "Open Command Prompt Here as Administrator" option in the context menu. Clicking on this option will open a Command Prompt window with administrative privileges in the selected directory.