So I'm trying to make a little Python script that will extract all items out of a folder into its parent directory. The script works fine but I want to add it to the context menu so whenever I right click a folder, it gets listed.

I followed this guide but I had a few problems:

  1. Only works on files, not folders.
  2. I get a "This app can't run on your PC" error (probably because of Win10)

Along with those problems, how can I add it to its own section in the context menu?

  • Have a look at the answers from this SE question: stackoverflow.com/questions/20449316/… - it appears the registry key in the guide you have followed is linking to files. If you remove the "Background" level then this targets directories.
    – Kinnectus
    Sep 9, 2015 at 8:51

1 Answer 1


for your first problem:

Make sure you add the key to the right parent:

  • HKEY_CLASSES_ROOT\Directory\shell when you want to right click on a folder
  • HKEY_CLASSES_ROOT\Directory\Background\shell when you want to right click in the folder window

if you want to add a context entry for files, it's a bit more complicated. You normally add it for specific file-types (specific extensions). If you want to add it for every type, there's HKEY_CLASSES_ROOT\*

for your second problem:

You need to run the python application with your script as an argument. (and then probably "%1" for the file you right clicked on as a second argument) If you start your script by double clicking it or by typing it into a command-window, the system looks for the python application and runs it with your script as an argument.

So this is what you need to put into the registry key: c:\path\to\your\python.exe c:\path\to\yourScript.py "%1"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .