# How to add item to right-click menu when NOT selecting a folder or file? [duplicate]

How do I add a menu item to my context menu to open up powershell (or any other arbitary application) when I right-click inside Windows Explorer?

...but couldn't find any instructions on how to add menu items when doing this: (not selecting a folder or file)

I did find this and tried adding powershell to HKEY_CLASSES_ROOT\Directory\Background\shell\, (loosely based on the instructions I found and linked above) but it didn't work for me.

I'm running Windows 7, by the way. Also, I'm currently interested in adding only PowerShell, but I'd prefer a general solution I can apply to add any program to the context menu.

-

## marked as duplicate by Karan, soandos, Tanner Faulkner, Brad Patton, BreakthroughJun 1 '13 at 1:20

Steps:

1. Save this code in a file called powershell.reg:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell]
@="&Powershell"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell\command]
@="C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"

2. If your Windows folder is not C:\WINDOWS, change the script accordingly. Make sure to use double backslashes.

3. Double-click powershell.reg.

4. When asked if you're sure, click Yes.

5. Click OK.

This is the result:

This works, of course, for any program. Just replace every occurrence of Powershell and the full path of powershell.exe by, e.g., Windows Calculator and C:\\WINDOWS\\system32\\calc.exe.

-

The basic process is just as Dennis described in his answer.

The addition I have to make allow you to customize the icon displayed for the menu and also specify the placement of the item in the context menu.

1. Add an Icon String Value entry under the HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShell key.
2. Specify the path to the icon for the item.

1. Add a Position String Value entry under the HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell key.
2. Specify Top to place the item at the top of the menu or Bottom to place it at the bottom of the menu.

Below is a registry script of the procedures I described above. Paste it into notepad and save it as powershell.reg (or anything else but with the .reg extension). Then import it into the your system registry to add the menu item.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell]
@="&Powershell"
"Icon"="C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"
"Position"="Top"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell\command]
@="C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"


If you're feeling geeky enough and want to put multiple programs in a cascading menu, you can follow the instructions here.

-
I am trying to do the same thing, the problem is as in the image in the question above, the file path shows it is a "Library" and these Registry additions only seem to work when in a folder not accessed by "Library"....any ideas how to get it to work with Library being in the file path? –  JasonDavis Jan 13 '13 at 3:01
+1 for the Position=Top option, useful info. –  Curtis Tasker Sep 3 '13 at 17:37

Resurrecting this for the sake of completeness, as I just went through this while reinstalling my machine.

[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit cd '%1'"

[HKEY_CLASSES_ROOT\Directory\background\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit cd '%v'"


The first registry key is for the right click on a folder and the second registry key corresponds to right clicking while selecting nothing.

-