May 30, 200422 yr I thought I would share something I finally discovered that I was doing wrong when using the START command.From what I've seen, most people use the START command in this manner:START /WAIT C:\path\to\exe\some.exeThis works fine, but not if the path contains spaces.So one would think that to use the START command with a path that contains spaces, you would simply use:START /WAIT "C:\path with spaces\some.exe"But it doesn't work that way.Lets look at "START /?" in Command Prompt:START ["title"] [/Dpath] [/MIN] [/MAX] [/sEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [command/program] [parameters]The FIRST quoted parameter is actually the title of the window, so using the command: START /WAIT "C:\path with spaces\some.exe"will actually open a new command prompt window with a title of "C:\path with spaces\some.exe" and not actually execute some.exeThe trick is to provide a title parameter, which can be anything you want:START "" /WAIT "C:\path with spaces\some.exe"I just use double quotes with nothing in between (null)I always just assumed this was a limitation of the START command or that I didn't know how to use it properly, until I came across a post on alt.msdos.batch.nt (Windows NT tricks, traps and undocumented features)Your current START commands probably work just fine, but I find this usefull when the name of an installer EXE contains spaces, then I dont have to rename it (I like to preserve original filenames).
May 31, 200422 yr an what, if i use a command with no spaces in path butvariables? like:start /wait msiexec /x{B060295C-E378-484C-91BE-DB5C41383FE9} /qb
May 31, 200422 yr Author an what, if i use a command with no spaces in path butvariables? like:start /wait msiexec /x{B060295C-E378-484C-91BE-DB5C41383FE9} /qbI dont really know what you are asking?I just use START "" /WAIT no matter what because if you pass any parameter thats quoted without first providing a title parameter, you'll run into problems.You could do: start "" /wait msiexec /x{B060295C-E378-484C-91BE-DB5C41383FE9} /qbeven though its not really necessary in your case
June 1, 200422 yr Despite a good note from you, no path next to "start /wait" had spaces in all posts I've seen on this forum!People type this:start /wait "%systemdrive%\Install\appname\app.exe" /switchWith or without quotes, no difference.Thank you for your contribution.
June 1, 200422 yr Author Despite a good note from you, no path next to "start /wait" had spaces in all posts I've seen on this forum!People type this:start /wait "%systemdrive%\Install\appname\app.exe" /switchWith or without quotes, no difference.Thank you for your contribution.Nope, if you use quotes it will not work, try it!1. Open a Command Prompt2. Type: START /WAIT "%SYSTEMROOT%\system32\calc.exe"3. It doesn't open up calc.exe4. Remove the quotes and it does
June 1, 200422 yr quotes are used for spacesstart /wait "%systemdrive%\Install app name\appname.exe" /switch
June 1, 200422 yr Author quotes are used for spacesstart /wait "%systemdrive%\Install app name\appname.exe" /switchYes, quotes are necessary for spaces, but if you dont provide a TITLE parameter using quotes, it will not work!I dont think you guys are actually TRYING these commands before replying.Will work:START /WAIT C:\PATH\APP.EXESTART "title" /WAIT "C:\PATH\APP.EXE"START "title" /WAIT "C:\LONG PATH\APP.EXE"Will NOT work:START /WAIT "C:\PATH\APP.EXE"START /WAIT "C:\PATH WITH SPACES\APP.EXE"
June 3, 200422 yr For me putting the folder name in quotes works when using spaces:start /wait path\"folder name"\filename.exe
September 8, 200421 yr While we're discussing the start command, I'll mention another quirk I have noticed. If you use the /wait parameter, followed by the /b parameter, then the /wait parameter will not be honored. For those who don't recall, /b will completely hide the command window. However, usage of /b also seems to interfere with the /wait parameter, causing the script to immediately pass control to the next line even if the command invoked with /wait /b has not yet completed. Just FYI... - Ravashaak
September 8, 200421 yr Thanks for that post, very handy in solving an issue I'd had at work with a couple of installers. Even though the paths had no spaces, it seems some .exe's work, and some dont
September 10, 200421 yr Thanks! This is good info. Even though most people seem to avoid spaces, this info should be made more promenant because it is behavior by the start command that goes against what feels like common sense. So if people have this problem it would be very confusing to debug.Good to know.
Create an account or sign in to comment