Windows コマンド シェルから実行可能コマンドとして直接実行しようとすると、Python プログラムに渡されるコマンド ライン引数を取得できません。たとえば、このプログラム (test.py) があるとします。
import sys
print "Args: %r" % sys.argv[1:]
そして実行します:
>test foo
Args: []
と比較して:
>python test.py foo
Args: ['foo']
私の構成は次のとおりです。
PATH=...;C:\python25;...
PATHEXT=...;.PY;....
>assoc .py
.py=Python.File
>ftype | grep Python
Python.CompiledFile="C:\Python25\python.exe" "%1" %*
Python.File="C:\Python25\python.exe" "%1" %*
Python.NoConFile="C:\Python25\pythonw.exe" "%1" %*