What's the difference between the following cmd scripts?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Melt
--
Chapters
00:00 What'S The Difference Between The Following Cmd Scripts?
00:51 Accepted Answer Score 17
01:37 Answer 2 Score 5
01:58 Thank you
--
Full question
https://superuser.com/questions/727424/w...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows7 #script #cmdexe
#avk47
ACCEPTED ANSWER
Score 17
Start Chrome
This one works, because Chrome's executable is located in a folder which is in the PATH
environment variable. start
looks for programs in all folders in that variable. The environment variable PATHEXT
contains a list of file extensions to look for and as .exe
is contained by default, you don't need to write chrome.exe
.
start "FOO_DIR\FOO.exe"
This does not work, because start
will use its first argument as the window title if it is quoted. So this will open a new CMD with "FOO_DIR\FOO.exe"
as its title.
To circumvent this, you can simply add an empty title argument before your command:
start "" "FOO_DIR\FOO.exe"
ANSWER 2
Score 5
Try adding "title"
or at least ""
after start
like this:
start "title" "FOO_DIR\FOO.exe"
or
start "title" /B "FOO_DIR\FOO.exe"
The root cause of the problem is that first argument in "" quotes is interpreted as a title
parameter for new cmd
window.
Also it helps to look at the command reference (link)