From the Windows Taskbar, you can start a program elevated by holding the Ctrl & Shift keys and then clicking on a pinned shortcut. To launch a program elevated from the right-click menu, you can add custom entries and launch it using a script or using the NirCmd utility. Earlier we wrote about the new elevate command-line argument in NirCmd, which you can implement in the context menu.
This article tells you how to add a right-click menu option to run a program elevated.
Example: Add “Notepad (Administrator)” Option to the Context Menu
- Click Start, type
regedit.exe
and go to:HKEY_CLASSES_ROOT\*\shell
- Create a subkey named
Notepad
- Select Notepad, double-click the
(default)
value and set “Notepad (Administrator)
” as the data - Create a string value named
HasLUAShield
(This adds the UAC shield icon to the context menu item. Ref: Add UAC Shield Icon to the Right-Click Menu)
- Create a string value named Extended
- Under the
Notepad
key, create another subkey namedCommand
-
Select
Command
, and type in the following value data for(default)
"C:\Windows\System32\nircmd.exe" elevate notepad.exe "%1"(Assuming that you’ve copied NirCmd.exe to the Windows\System32 directory.)
- Exit the Registry Editor.
Press and hold the Shift key down, right-click on a file (say, the HOSTS file) that you want to edit using Notepad under elevated privileges, and then click Notepad (Administrator)
Other Possible Uses
Register and Unregister DLLs from the Right-click menu. (REG file)
Open an elevated Command Prompt window from the Desktop context menu. (REG file)
Take Ownership of a file or folder from the context menu. (REG file)
One small request: If you liked this post, please share this?
One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
My hero! That’s just what I needed.
Now, Notepad isn’t as good a candidate as Notepad++ is; especially when a Hex Editor plug-in is installed on the Notepad++. Think of the possibilities!
Anyone got a way to do this on Win 7 64?
You don’t need nircmd, because you can do it natively in Win7. Create a shortcut to your favourite text editor. Edit the properties of the shortcut and under compatibility, click run as administrator.
Follow the rest of this tutorial but instead of putting nircmd in the registry, put the full path to your shortcut. Works perfectly without installing dodgy third-party software.
I also found this only to work the way I wanted it to if I didn’t include the “Extended” string value.
Thank you! <3 Clear instructions even for a green with computers girl!