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:

HKEY_CLASSES_ROOT\*\shell

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)


Email SubscriptionPrefer an E-mail subscription?

Enter your email address:

Delivered by FeedBurner

5 Comments

  1. Lajla
    said this on Wednesday, January 15th 2014 3:17 pm

    Thank you! <3 Clear instructions even for a green with computers girl!

  2. Miles
    said this on Monday, March 18th 2013 11:46 am

    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.

  3. psiber
    said this on Wednesday, February 22nd 2012 9:15 pm

    Anyone got a way to do this on Win 7 64?

  4. said this on Thursday, August 19th 2010 8:02 am

    […] How to Run a Program Elevated via the Right-Click Menu in Windows 7/Vista? [The Winhelponline Blog] | More document.write(''); Posted on 08/18/10 […]

  5. Fleet Command
    said this on Thursday, August 19th 2010 3:06 am

    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!

Leave a Reply