Add to Context Menu

Solution 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"