Help - Search - Members - Calendar
Full Version: A Little Tip For Using The START Command
MSFN Forums > Unattended Windows Discussion & Support > Application Installs

   
Google Internet Forums Unattended CD/DVD Guide
pinout
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.exe

This 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] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [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.exe

The 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).
spachtler
an what, if i use a command with no spaces in path but
variables? like:

CODE
start /wait msiexec /x{B060295C-E378-484C-91BE-DB5C41383FE9} /qb
pinout
QUOTE (spachtler @ May 31 2004, 03:40 AM)
an what, if i use a command with no spaces in path but
variables? like:

CODE
start /wait msiexec /x{B060295C-E378-484C-91BE-DB5C41383FE9} /qb

I 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} /qb

even though its not really necessary in your case
mazin
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" /switch

With or without quotes, no difference.

Thank you for your contribution.
pinout
QUOTE (mazin @ May 31 2004, 06:19 PM)
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" /switch

With 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 Prompt
2. Type: START /WAIT "%SYSTEMROOT%\system32\calc.exe"
3. It doesn't open up calc.exe
4. Remove the quotes and it does
MCT
quotes are used for spaces

start /wait "%systemdrive%\Install app name\appname.exe" /switch
pinout
QUOTE (MCT @ Jun 1 2004, 04:53 PM)
quotes are used for spaces

start /wait "%systemdrive%\Install app name\appname.exe" /switch

Yes, 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.EXE
START "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"
bktbo
Interesting post pinout.
Works as you described.

Thanks
Tyke
For me putting the folder name in quotes works when using spaces:
start /wait path\"folder name"\filename.exe
eworld
Thanks, solve my problem !! thumbup.gif
ravashaak
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
draxx
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 smile.gif
smknight
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.
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.