How to Run a Program Elevated via the Right-Click Menu in Windows 7/Vista?

In the Windows 7 Taskbar, you can start a program elevated by holding the CTRL & SHIFT keys and then clicking on a Pinned shortcut. Unfortunately there are no keyboard shortcuts available to start a program elevated via the context menu. 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.

Add "Notepad (Administrator)" Option to the Context Menu

1. Click Start, type Regedit.exe and go to:


2. Create a subkey named Notepad

3. Select Notepad, double-click the (default) value and "Notepad (Administrator)" as the value data

4. Create a string value named HasLUAShield

(This adds the UAC shield icon to the context menu item in Windows 7. REF: Add UAC Shield Icon to the Right-Click Menu)

5. Create a string value named Extended

6. Under Notepad key, create another subkey named Command

7. 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.)

8. 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

#1 Register and Unregister DLLs from the Right-click menu. (REG file)

#2 Open an elevated Command Prompt window from the Desktop context menu. (REG file)

#3 Take Ownership of a file or folder from the context menu. (REG file)

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.

5 thoughts on “How to Run a Program Elevated via the Right-Click Menu in Windows 7/Vista?

  1. 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.

  2. 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!

Comments are closed.