Dos path name with space character

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.
 
S

Shenan Stanley

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.
 
O

Ong

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.
 
P

Pegasus \(MVP\)

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
 
O

Ong

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top