JSI Tip 9203. The Start command fails when you use a command/program with a space, even though it is quoted?

When you type Start /?, you receive:

Starts a separate window to run a specified program or command.

START \["title"\] \[/Dpath\] \[/I\] \[/MIN\] \[/MAX\] \[/SEPARATE | /SHARED\]
      \[/WAIT\] \[/B\] \[command/program\]

    "title"     Title to display in  window title bar.
    path        Starting directory
    B           Start application without creating a new window. The
                application has ^C handling ignored. Unless the application
                enables ^C processing, ^Break is the only way to interrupt
                the application
    I           The new environment will be the original environment passed
                to the cmd.exe and not the current environment.
    MIN         Start window minimized
    MAX         Start window maximized
    SEPARATE    Start 16-bit Windows program in separate memory space
    SHARED      Start 16-bit Windows program in shared memory space
    LOW         Start application in the IDLE priority class
    NORMAL      Start application in the NORMAL priority class
    HIGH        Start application in the HIGH priority class
    REALTIME    Start application in the REALTIME priority class
    ABOVENORMAL Start application in the ABOVENORMAL priority class
    BELOWNORMAL Start application in the BELOWNORMAL priority class
    WAIT        Start application and wait for it to terminate
                If it is an internal cmd command or a batch file then
                the command processor is run with the /K switch to cmd.exe.
                This means that the window will remain after the command
                has been run.

                If it is not an internal cmd command or batch file then
                it is a program and will run as either a windowed application
                or a console application.

    parameters  These are the parameters passed to the command/program
Using this syntax, you should be able to type start "My Windows Title" "%USERPROFILE%\My Documents\test.bat" "P 1" "p 2" "p 3"

When you do, you receive a My Windows Title command windows with the following error:

'C:\Documents' is not recognized as an internal or external command, operable program or batch file.

NOTE: when you use start "%USERPROFILE%\My Documents\test.bat" "P 1" "p 2" "p 3", you receive:

The system cannot find the file P 1.

When you run call "%USERPROFILE%\My Documents\test.bat" "P 1" "p 2" "p 3"
or just "%USERPROFILE%\My Documents\test.bat" "P 1" "p 2" "p 3", the command runs as expected.

To workaround this behavior, you can use the Start command by specifying the /D switch:

start "My Windows Title" /D"C:\%USERPROFILE%\My Documents" test.bat "P 1" "p 2" "p 3"

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.