This question already has an answer here:

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?

I found tons of links on how to add menu items when doing this: (selecting a folder; example link)

right-clicking a folder

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

not right-clicking anything

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, Breakthrough Jun 1 '13 at 1:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



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

    Windows Registry Editor Version 5.00
  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.

Context Menu Icon

  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.

Position of Menu 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



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
  • @JasonDavis: Replace Directory in HKEY_CLASSES_ROOT\Directory\Background with LibraryFolder (i.e.: [HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\Powershell] and [HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\Powershell\command]). The rest of the process is the same. – Alex Essilfie Dec 12 '15 at 7:30
  • @AlexEssilfie Great find on the Position value! I've been editing the registry for years and never come across it. How did you come across it, and do you know of any resources that list all similar possible values for context menu-related? Would really appreciate it. – Hashim Aug 20 '17 at 23:50

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

@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit cd '%1'"

@="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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.