launch a .py file from a batch file
davea at ieee.org
Tue Jun 23 23:52:34 CEST 2009
Che M wrote:
> On Jun 23, 5:30 am, Paul Moore <p.f.mo... at gmail.com> wrote:
>> 2009/6/23 C M <cmpyt... 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
>>> With quotes it just opens a console and does nothing (does not launch the
>>> Any ideas?
>> @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.
> Unfortunately, when I try that it says "Windows cannot find [that
> file]", etc.
> And yet I am copying the filename right from the file manager and it
> What's also odd is that if I open the file using cd and then just
> the filename on the next line, that file (which I gave a .pyw
> doesn't open, but a file that has a .py extension does.
> Any ideas?
If you run the xx.pyw file interactively, does it work? If not, perhaps
the pyw file association is broken. It, along with the py association,
should have been set up by the Python install.
You can check it (and fix it) with
assoc and ftype. Here's what mine look like:
Python.NoConFile="C:\ProgFiles\Python26\pythonw.exe" "%1" %*
Or, as I said in an earlier message, you could explicitly specify the
interpreter to be run on the start line.
@start "notitle" "c:\ProgFiles\Python26\pythonw.exe" "path\script.pyw"
More information about the Python-list