Re: launch a .py file from a batch file



Paul Moore wrote:
2009/6/23 C M <cmpython@xxxxxxxxx>:
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.

CM - Paul is right. If you have to use quotes, then you also need the extra argument to hold the "title" for the command window that won't be created. Stupid syntax on "Start.exe". I seldom hit that because I try not to put anything in a directory with spaces in it, like "Program Files" or "Documents and Settings"

I have uncovered dozens of bugs in other people's programs over the years that were triggered by spaces in the pathname. It's not so bad now, but still can bite you.


.



Relevant Pages

  • Re: launch a .py file from a batch file
    ... That's of course after you rename your script to a pyw extension. ... which doesn't need a command window. ... With quotes it just opens a console and does nothing (does not launch the ...
    (comp.lang.python)
  • Applescript and Autoformat (search and replace), Word 2004
    ... script that will take care of a recurring editing issue with nested ... quotes to double quotes, ... set oldauto2 to auto format as you type replace quotes ... set auto format as you type replace quotes to false ...
    (microsoft.public.mac.office.word)
  • Re: Accessing full command line or parameters WITH QUOTES
    ... The problem is that VBScript doesn't allow access to the full command line ... rebuild the parameters with the quotes inserted properly. ... When I was writing the script on XP, I managed to cheat and grab the ...
    (microsoft.public.scripting.vbscript)
  • Re: Database/Email Script
    ... Both double and single quotes work for quoting array indexes. ... the relevant code. ... What I would like first would be to get the script working. ... task as a learning experience.) ...
    (comp.lang.php)
  • Re: Interesting Discussion with my PHP Teacher
    ... ## For a small script like this one, ... > it wher the sql statement is constructed because there are too many quotes. ...
    (comp.lang.php)