Command line arguments in Windows
Mark Tolonen
mark.e.tolonen at mailinator.com
Tue Mar 4 02:15:59 EST 2008
"Mike Walker" <mhwalker at shaw.ca> wrote in message
news:r76zj.40666$pM4.38793 at pd7urf1no...
>
>> If you run a python file, ie. just double clicking it the only
>> argument you will have will be the filename of the script. If you
>> create a shortcut to the script and in the target box add your
>> arguments (if you have quotation marks place them after not inside)
>> you will see your arguments. fwiw you answered yourself in the third
>> paragraph.
>
> As I mentioned I am working from the command line, not clicking on the
> icon. The only difference between it working and not is the python prefix,
> which is why I was thinking this is some sort of file association problem.
>
> I probably wasn't as clear as I could have been in the third paragraph.
>
> argtest.py arg1 arg2 arg3 - Does not work only get sys.argv[0]
> python argtest.py arg1 arg2 arg3 - Works
>From the command line, the 'ftype' and 'assoc' commands can be used
view how an extension is handled:
C:\>assoc .py
.py=Python.File
C:\>ftype Python.File
Python.File="C:\Python25\python.exe" "%1" %*
My guess is your command line looks something like this:
Python.File="C:\Python25\python.exe" "%1"
The script name is being passed, but not the rest of the arguments.
I vaguely remember seeing this on an older version one of ActiveState's
ActivePython installers. What version of Python are you running?
--Mark
More information about the Python-list
mailing list