Run Python scripts from Windows command line, argument not passed Run Python scripts from Windows command line, argument not passed windows windows

Run Python scripts from Windows command line, argument not passed


I had the same problem with Windows 7 / Python, and eventualy found that I had to set up correct file associations AND update two registry entries through regedit.

It is all described in this excelent article:

http://eli.thegreenplace.net/2010/12/14/problem-passing-arguments-to-python-scripts-on-windows/


To move the answer to SO (rather than the link in Jon's answer):

Modifying the following two registries so that the arguments are passed along to Python:

HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\commandHKEY_CLASSES_ROOT\py_auto_file\shell\open\command

Add %* to the existing "C:\PythonXX\python.exe" "%1", so that the key now looks like: "C:\PythonXX\python.exe" "%1" %*.

Source: http://eli.thegreenplace.net/2010/12/14/problem-passing-arguments-to-python-scripts-on-windows/