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

S

Stef Mientki

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
 
M

Mike Driscoll

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top