Skip to content
Little GolemMake your next move.

MS-DOS question

Public forum discussion.

General

#1 · David J Bush

6 Nov 2010

I have Windows XP SP3. From within the command.com window, I want to use the dir command to switch to the child directory "Program Files" which has a space in it. I tried single quotes, double quotes, to no avail. Any clue would be welcome. Thanks.

#3 · Greck

6 Nov 2010

I tried with no special symbol, but a space in between... and it worked :)

#4 · ypercube

6 Nov 2010

cd "Program Files"

might work too :)

#5 · ypercube

6 Nov 2010

If you are not on the root directory, you have to give:

cd "C:\Program Files"

or

cd C:\progra~1

#6 · Thomas Werner

6 Nov 2010

Hi all,

I guess that the fundamental error is to use the 'dir' command. ;-)

As everybody said implicitly: the cd command should work.

Here's how to achieve the desired with command.com:

C: // switches to drive C: (assuming that your Program Files directory is on C:)

cd \ // changes to the root directory of drive C:

dir /X P* // shows the short 8+3 and the long names of all folders and files in C:\ starting with P*

cd PROGRA~1 // assuming that the short name of Program Files is PROGRA~1

So ypercube is 100% right. Hyphenation does not save you here, because DOS's not UNIX. :-D (Don't even think about masking the space with a backslash.)

I recommend CMD over COMMAND, though. It can handle long file names. Just press WINDOWS+R and enter CMD instead of COMMAND. In CMD, you go

C:

cd \Pro and the -key does some magical auto-completion.

Thomas

#7 · David J Bush

6 Nov 2010

CMD did the trick. Thanks to all for your suggestions.

#8 · FatPhil

6 Nov 2010

change the completion character to be tab, then just 'tab complete' everything.

Of course, I'm obliged to say "just do a proper OS, rather than a lame-ass piece of shite" - so consider it said.