Weird behavior when launching app from CMD with/without start
I am writing a batch file
Version 1:
"c:\Program Files (x86)\Notepad++\notepad++.exe"
start explorer .
Version 2:
start "c:\Program Files (x86)\Notepad++\notepad++.exe"
start explorer .
V1 opens notepad++ but then, alas, does not continue execution before notepad++ closes again.
V2 doesn't open notepad++ but instead opens a new command line window with the name "c:\Program Files (x86)\Notepad++\notepad++.exe", then opens explorer in my current directory.
How do I start notepad++ without blocking the execution of the next command?
This is well known quirk, just put empty pair of quotes as first start
parameter.
start C:\MinGW\msys\1.0\msys.bat
start "" "c:\Program Files (x86)\Notepad++\notepad++.exe"
start explorer .
See http://ss64.com/nt/start.html for details.
The problem with the second attempt
start "c:\Program Files (x86)\Notepad++\notepad++.exe"
is known behavior. In particular:
start "bob"
will open a new CMD window with the title "bob"
The way to get your program to launch without blocking is as follows:
start c:\"Program Files (x86)"\Notepad++\notepad++.exe"