Navigating in DOS

P

PT

If I click run | command, I get a DOS prompt at the folder c:\documents and
settings\username.

If I then run the command "dir" I get a listing of the various subfolders
off documents and settings \ username folder.

One of them, which I want to access is "My Documents". But because of the
empty space between "My" and "Documents" I can't simply enter "cd my
documents".

So what's the syntax for accessing such multi-word folder names?
 
J

JS

cd "my documents"

You need to use quotes for any folder names that
contain spaces in the name.
 
A

Andrew McLaren

PT said:
One of them, which I want to access is "My Documents". But because of the
empty space between "My" and "Documents" I can't simply enter "cd my
documents".

In XP and Vista, CMD command-line completion is enabled by default.

For example: in your home directory, type "cd " (with a space at the
end) and then press the <Tab> key. The first directory name will be
inserted into the command. Keep pressing the <Tab> key to cycle through
all available directories.

If you type "cd m" and press <Tab>, CMD looks for the first directory
name which starts with M. If there are spaces in the name, quotes are
automatically placed around the directory name. So you will see:

C:\Documents and Settings\Username> cd "My Documents"

Then press <Enter> to run the command.

Hope it helps,

Andrew
 
P

Pegasus [MVP]

PT said:
If I click run | command, I get a DOS prompt at the folder c:\documents
and
settings\username.

If I then run the command "dir" I get a listing of the various subfolders
off documents and settings \ username folder.

One of them, which I want to access is "My Documents". But because of the
empty space between "My" and "Documents" I can't simply enter "cd my
documents".

So what's the syntax for accessing such multi-word folder names?

As a general rule, you need to surround file/folder names with double quotes
when they contain spaces, as JS pointed out. There is, however, one
exception: the "CD" command. The following command will work, even if you
think it doesn't:

cd \Documents and Settings\PT\My Documents
 
L

Lem

PT said:
If I click run | command, I get a DOS prompt at the folder c:\documents and
settings\username.

If I then run the command "dir" I get a listing of the various subfolders
off documents and settings \ username folder.

One of them, which I want to access is "My Documents". But because of the
empty space between "My" and "Documents" I can't simply enter "cd my
documents".

So what's the syntax for accessing such multi-word folder names?

Command.com is a 16-bit application used for compatibility with certain
older programs. Use cmd.exe instead, which is the NT command line
interface. Among other things, cmd.exe understands long file names and
how to parse spaces in file names.

--
Lem -- MS-MVP

To the moon and back with 2K words of RAM and 36K words of ROM.
http://en.wikipedia.org/wiki/Apollo_Guidance_Computer
http://history.nasa.gov/afj/compessay.htm
 
J

James P. H. Fuller

So what's the syntax for accessing such multi-word folder names?

If you want to write a .bat or .cmd script, enclose your path within quotes
as others have suggested. If you just want to cruise around the FS and have a
command line available, it's a lot more convenient to install the Command
Window Here power toy. With this on board you can point-click navigate into
all the obscure nooks and crannies using explorer as usual. When you come to
where you want a black screen and a > prompt just right-click on the
directory (My Documents, for instance) and select "Open Command Window Here"
-- there you are in a command window and your prompt is (in my case)
C:\Documents and Settings\721jpf\My Documents>.

Then you can hit alt-<enter> and the command window goes full screen text
mode white on black 80 columns 24 lines and SHAZAM it's 1986 again.
 
J

Jose

If I click run | command, I get a DOS prompt at the folder c:\documents and
settings\username.

If I then run the command "dir" I get a listing of the various subfolders
off documents and settings \ username folder.

One of them, which I want to access is "My Documents".  But because of the
empty space between "My" and "Documents" I can't simply enter "cd my
documents".

So what's the syntax for accessing such multi-word folder names?

If there are not too many matches you can use wild cards and type
something like:

cd my* or cd prog* or, as by old DOS habits start to kick in, cd
m*.* If there are too many matches, just add more characters as
needed before the * to narrow it down.

Putting it in quotes also works, but requires more keystrokes. 6
versus 17 not counting <enter>.

I could not get cd m to work, but maybe it is just me. cd <tab> - I
never knew that! I go for as few keystrokes or mouse clicks as
possible.

And hopefully, if you want to get back to c:\ you do not type in cd..
<enter> cd..<enter> when just a cd\<enter> will do.

You can also tell the command prompt where you want it to start when
you start it. I changed mine to start in the root of c:\

Here is a link to change the start in folder: http://windowsxp.mvps.org/autoruncmd.htm
 
S

Stan Weiss

If you use the DIR command with the /x option it will show you the 8.3
name to use for any file or folder name that is not in 8.3 format
 
R

ramannanda991

you have to use quotes and auto-completion is available in windows but if the path is really long thenFaster way :)
 

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