Windows is not passing command line arguments to Python programs executed from the shell Windows is not passing command line arguments to Python programs executed from the shell python python

Windows is not passing command line arguments to Python programs executed from the shell


I think I solved this. For some reason there is a SECOND place in the registry (besides that shown by the file associations stored in HKEY_CLASSES_ROOT\Python.File\shell\open\command):

[HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command]@="\"C:\\Python25\\python.exe\" \"%1\" %*"

This seems to be the controlling setting on my system. The registry setting above adds the "%*" to pass all arguments to python.exe (it was missing in my registry for some reason).


My setting was under yet another registry key, HKEY_CLASSES_ROOT\py_auto_file. The other keys mentioned also existed, but Windows was using this one for some reason.


For Python 3.3 on Windows 7, my setting was under another registry key; the key I changed to make the arguments get passed was

HKEY_USERS\S-1-5-21-3922133726-554333396-2662258059-1000_Classes\py_auto_file\shell\open\command

It was "C:\Python\Python33\python.exe" "%1". I only appended %* to it. The key's value is now "C:\Python\Python33\python.exe" "%1" %*.

I had several (at least five) other keys with the value "C:\Python\Python33\python.exe" "%1", but this is the one I changed that made it work.