Running a Python program thru a Windows shortcut

Bengt Richter bokr at oz.net
Mon May 12 00:12:30 EDT 2003


On Sun, 11 May 2003 20:18:29 -0700, "Kevin Altis" <altis at semi-retired.com> wrote:

>This is the right answer, stated succinctly. The only thing I would add is
>that if you don't want a console window to appear, either use pythonw.exe
>instead of python.exe or rename your script to dfc.pyw instead of dfc.py.
>Just ignore Mr. Roth's post, there is no need to use a batch file.
>
>ka
>
>"TheDustbustr" <thedustbustr at aol.com> wrote in message
>news:20030511190020.03191.00000229 at mb-m07.aol.com...
>right click> new> shortcut
>command line:
>C:\python22\python.exe c:\path\to\dfc.py dfcCfgBackup
>
>remember, in python, sys.argv is a tuple containing args passed in.
>
>Depending on your windows version, you MAY have to put python in
>double-quotes,
>like so:
>"C:\python22\python.exe" c:\path\to\dfc.py dfcCfgBackup
>
And the same probably goes for any other chunk on the line with embedded spaces. E.g.,

[21:14] C:\pywk\pypy>pargs.py "a single arg" "also one" and some more
argv[0]: "C:\UTIL\pargs.py"
argv[1]: "a single arg"
argv[2]: "also one"
argv[3]: "and"
argv[4]: "some"
argv[5]: "more"

Regards,
Bengt Richter




More information about the Python-list mailing list