How to Add an "Open Command Prompt Here As Administrator" Shortcut to the Context Menu in Windows 7 and Windows Vista

Revision as of 15:45, 21 March 2023 by Lukegao1 (talk | contribs) (创建页面,内容为“ 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…”)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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.