Dos path name with space character

  • Thread starter Thread starter Ong
  • Start date Start date
O

Ong

Recently I wrote a batch file to launch a program located in a folder
containing space character in its name. Neither of the following scripts I
used worked:

start "c:\Test 1\" abc.exe
start "c:\Test~1\" abc.exe

Using 'dir /x' on DOS prompt at C:\, the correct DOS path name shown for
'C:\Test 1' is 'C:\Test1~1'. I replaced the path name in my script with this
& the script worked accordingly.
 
Ong said:
Recently I wrote a batch file to launch a program located in a
folder containing space character in its name. Neither of the
following scripts I used worked:

start "c:\Test 1\" abc.exe
start "c:\Test~1\" abc.exe

Using 'dir /x' on DOS prompt at C:\, the correct DOS path name
shown for 'C:\Test 1' is 'C:\Test1~1'. I replaced the path name in
my script with this & the script worked accordingly.

The answer is much simpler...

start "c:\Test 1\abc.exe"

In other words - the quotes go around the entire path - including the
filename.
 
Shenan Stanley said:
The answer is much simpler...

start "c:\Test 1\abc.exe"

I've tried this as well but it doesn't work.
A DOS window with "c:\Test 1\abc.exe" as title will be shown instead.
 
Ong said:
Recently I wrote a batch file to launch a program located in a folder
containing space character in its name. Neither of the following scripts
I
used worked:

start "c:\Test 1\" abc.exe
start "c:\Test~1\" abc.exe

Using 'dir /x' on DOS prompt at C:\, the correct DOS path name shown for
'C:\Test 1' is 'C:\Test1~1'. I replaced the path name in my script with
this
& the script worked accordingly.

When you type start /? then you'll see that the title for the
process comes first:

start "My Process" "c:\Test 1" abc.exe
 
Pegasus (MVP) said:
When you type start /? then you'll see that the title for the
process comes first:

start "My Process" "c:\Test 1" abc.exe

OIC. That works. Thx.
 
Back
Top