Add PowerShell to a folder's context menu

On Windows, I want the ability to call PowerShell by right-clicking onto a folder.

Not a problem, open PowerShell for the last time from the start menu. Reminder: It's under "W" like "Windows PowersHell".

Call the command regedit:

Select HKEY_CLASSES_ROOT -> Folder -> shell -> PowerShell -> command. Put in cmd /K cd %L && powershell

Now start Windows Explorer and right-click on any folder there. You will see "PowerShell" in the context menu:

If you click on it, you will be in the respective folder in PowerShell:

What did we do here?

We added a key to the Windows Registry. This is the central key-value store for all Windows programs, mostly storing configuration data. In this case Windows Explorer will consume the config data for displaying context menus on a folder.
The key is "Default" and it will be executed. The value is cmd /K (run a command) cd %L (change to the directory handed over in the variable L) && (if the previous command was successful, run the following command) powershell (call PowerShell).

See also

  • I got my inspiration for this post from
  • Why does && mean "if the previous command was successful, execute the following command"? Know that this works under Windows and Linux and read
  • powershell -noexit & cd '%L' is better
  • Todo

  • Test it on a virgin computer. Is there really in a default registry Folder -> shell -> PowerShell?
  • Why does just running powershell terminate while running cmd && powershell does not?
  • Comments

    Popular posts from this blog

    Set up a webcam with Linux

    PuTTY: No supported authentication methods available

    My SAT>IP Server