launch a .py file from a batch file

Paul Moore p.f.moore at gmail.com
Tue Jun 23 11:30:25 CEST 2009


2009/6/23 C M <cmpython at gmail.com>:
>> Assuming you're running on Windows XP, try the following line in your
>> batch file:
>> @start path\MyPythonApp.pyw
>>
>> That's of course after you rename your script to a pyw extension.  That's
>> associated with pythonw, which doesn't need a command window.
>
> Well, I renamed my script to have a .pyw extension, and then ran the line
> above.  Without quotes, it doesn't find it (because I have spaces in the
> path).
> With quotes it just opens a console and does nothing (does not launch the
> app).
>
> Any ideas?

Use

@start "" "path\MyPythonApp.pyw"

The first item in quotes is the window title. If you only include the
path (in quotes) it's taken as a title, which is why you need the
second set of quotes.

Paul.



More information about the Python-list mailing list