win-shortcuts, file associates and command-line parameters ?

Mike Driscoll kyosohma at gmail.com
Thu Apr 10 16:24:09 EDT 2008


On Apr 10, 2:03 pm, Stef Mientki <stef.mien... at gmail.com> wrote:
> hello,
>
> under windows I tried to make a shortcut to a py -file, to run a program.
> So making a shortcut like this works perfect:
>   D:\PyLab_Works.py
>
> But the problem is that I need to give some commandline parameters to
> the py-file,
> and
>
>   D:\PyLab_Works.py   btc_test
> But the parameter doesn't seem to arrive in the python program
>
> If I start with the python interpreter, the parameters do arrive at the
> program
>   P:\pythonw.exe   D:\PyLab_Works.py   btc_test
> Although this method works,
> it makes the creation of shortcuts difficult (the paths are in real much
> longer).
>
> Is there a way to pass the commandline parameters correctly,
> without explicitly specifying the python interpreter ?
>
> thanks,
> Stef Mientki

I'm not sure what you're doing wrong. It works for me. I do have
Python on my system path though. I did this:

Created a shortcut to my script (test.py). Right-clicked it and chose
Properties. Changed it to look like this:

C:\Python25\test.py -i

Pressed Ok and ran it. It received my parameter just fine. If you want
to use pythonw.exe by default, you'll want to change the extension of
your script to *.pyw

Mike



More information about the Python-list mailing list