Re: launch a .py file from a batch file
- From: Dave Angel <davea@xxxxxxxx>
- Date: Mon, 22 Jun 2009 20:04:39 -0400
CM wrote:
I'd like to launch a number of programs, one of which is a Python GUIAssuming you're running on Windows XP, try the following line in your batch file:
app, from a batch file launcher. I'd like to click the .bat file and
have it open all the stuff and then not show the "DOS" console.
I can launch an Excel and Word file fine using, e.g.:
Start "" "path/mydocument.doc"
But if I try that with a Python file, like:
Start "" "path/myPythonApp.py"
It does nothing. The others open fine and no Python app.
However, if I do this instead (where path = full pathname to Python
file),
cd path
myPythonApp.py
it will launch the Python app fine, but it will show the "DOS"
console.
How can I get it to launch a .py file and yet not show the console?
Thanks,
Che
@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.
Your batch file itself will still display a cmd window while it's running, but it'll finish quickly. This is the same as when using one to start a spread*** or whatever.
If you cannot change the extension to the correct pyw extension, then try specifying the interpreter explicitly in the start line:
@start c:\python26\pythonw.exe path\MyPythonApp.py
You may need quotes in either of these cases, if you managed to include spaces in your pathnames.
.
- References:
- launch a .py file from a batch file
- From: CM
- launch a .py file from a batch file
- Prev by Date: Re: re.NONE
- Next by Date: Re: re.NONE
- Previous by thread: launch a .py file from a batch file
- Next by thread: Re: launch a .py file from a batch file
- Index(es):