Dumb question?

  • Thread starter Thread starter DH
  • Start date Start date
D

DH

Thanks in advance.

When I go to a command prompt and I want to change the directory to "My
Documents" what is the command?

I tried:
cd\ c:\docume~1\dave\my doc~1
cd\ c:\docume~1\dave\my_doc~1
cd\ c:\docume~1\dave\mydocu~1

Just to mention a few. I feel like I need to be dope slapped,

Dave H.
 
DH said:
Thanks in advance.

When I go to a command prompt and I want to change the directory to "My
Documents" what is the command?

I tried:
cd\ c:\docume~1\dave\my doc~1
cd\ c:\docume~1\dave\my_doc~1
cd\ c:\docume~1\dave\mydocu~1

Just to mention a few. I feel like I need to be dope slapped,

Dave H.

"cd" is a command. It cannot possible have a trailing backslash.

The easiest way is probably to do this in stages, e.g. like so:
c: {Enter}
cd \docu* {Enter}
cd dave {Enter}
cd my docu* {Enter}

When you refer to a file or folder name then you must almost
always enclose it with double quotes, e.g.

"c:\documents and settings"

the "cd" command is perhaps the only command that does
not require double quotes, hence both of these will work:

cd "c:\documents and settings"
cd c:\documents and settings
 
My mistake. The below (cd "c:\documents...etc) won't work from another
drive.

Try...

c: <enter>
cd "documents and settings\%username%\my documents" <enter>

You must change to the drive first.

-Frank
 
Pegasus (MVP) said:
"cd" is a command. It cannot possible have a trailing backslash.

The easiest way is probably to do this in stages, e.g. like so:
c: {Enter}
cd \docu* {Enter}
cd dave {Enter}
cd my docu* {Enter}

When you refer to a file or folder name then you must almost
always enclose it with double quotes, e.g.

"c:\documents and settings"

the "cd" command is perhaps the only command that does
not require double quotes, hence both of these will work:

cd "c:\documents and settings"
cd c:\documents and settings

Okay, I tried every command that you suggested with the same responses ""Bad
command or file name" or Parameter....."

Try it on your XP command prompt.

I do appreciate your effort - thank you,

Dave H.
 
Frankster said:
cd "c:\documents and settings\%username%\my documents"

-Frank

Thanks for the response but give it a try and see what you get. "Parameter
format not correct - "c:\documents"

Dave H.
 
It does work, with a slight modification:

cd /d "documents and settings\%username%\my documents" <enter>
 
Pegasus (MVP) said:
It does work, with a slight modification:

cd /d "documents and settings\%username%\my documents" <enter>

thanks but ""Invalid switch - /d"

Dave H.
 
Pegasus said:
It does work, with a slight modification:

cd /d "documents and settings\%username%\my documents" <enter>

Instead of %username% use %userprofile%

cd /d "%userprofile%\my documents"

This takes into account that some profiles may have a suffix as in
username.computername or username.domainname
 
DH said:
thanks but ""Invalid switch - /d"

Dave H.

Your consistent reports about invalid commands and invalid
switches makes me suspect that you either do not run them
under WinXP or that you're not typing what I suggest. To
nail this down, please carry out the following instructions
VERBATIM:

1. Click Start / Run
2. Type this:
notepad c:\test.bat
then press Enter.
3. Copy and paste the following three lines into the notepad.
Do NOT retype them!
@echo off
cd /d "c:\Documents and Settings\%UserName%\My Documents 1>c:\test.log
2>&1
cd >> c:\test.log
(The second line is very long. It starts with "cd" and ends with "1".
If it wraps in your newsreader then you must unwrap it.)
4. Save and close this file.
5. Click Start / Run
6. Type
c:\test.bat
then press Enter.
7. Click Start / Run
8. Type
notepad c:\test.log
then press Enter.
9. Copy and paste the content of this file into your reply.
 
Kerry Brown said:
Instead of %username% use %userprofile%

cd /d "%userprofile%\my documents"

This takes into account that some profiles may have a suffix as in
username.computername or username.domainname

Okay, I have tried:

(exact keystrokes)

cd /d dave\my documents
Invalid switch - /d


cd /d userprofile/my documents
Invalid switch- /d

Go to your command prompt and give it a try. Maybe it's my system. If you
can do it, give me the text and I will try it.

And if I haven't made it clear, I am appreciative of all the efforts,

Dave H.
 
DH said:
Okay, I have tried:

(exact keystrokes)

cd /d dave\my documents
Invalid switch - /d


cd /d userprofile/my documents
Invalid switch- /d

Go to your command prompt and give it a try. Maybe it's my system. If you
can do it, give me the text and I will try it.

And if I haven't made it clear, I am appreciative of all the efforts,

Dave H.

Type it exactly like this including the quotations and percent signs. Make
sure you use forward slash / and back slash \ in the right spots. They all
have special meanings to Windows.

cd /d "%userprofile%\my documents"

You can even highlight the above line, right click and copy it. Then right
click in the cmd prompt and paste it.
 
Kerry Brown said:
Type it exactly like this including the quotations and percent signs. Make
sure you use forward slash / and back slash \ in the right spots. They all
have special meanings to Windows.

cd /d "%userprofile%\my documents"

You can even highlight the above line, right click and copy it. Then right
click in the cmd prompt and paste it.

Invalid switch- /d"dave"\my
 
DH said:
Invalid switch- /d"dave"\my

Now what's happened to the space that Kerry placed after
the /d switch? If you wish to work from the Command Prompt
then you have to be careful about your spaces, slashes and
switches! If you don't wish to be burdened by such tedious
details then you should stick to GUIs.
 
Lets try something that a tiny bit different here...

Get the Command Prompt up - make sure you are in the C drive if not type in
'C:' without the single quotes and hit enter. If you're not in the C drive
this will put you into C's root.

If you are in the C drive go to the root - do a 'cd \' and hit enter (that's
a cd with a space and then a \). Now you will be in the root of the drive.

From here to make it a little easier to traverse through directories -
instead of having to worry about spaces and long file or folder names -
without putting the c:\ at the beginning do this:
cd d <- from here keep hitting the Tab key until you see
"Documents and Settings" and hit enter
cd d <- keep hitting Tab again until you see dave and hit enter
cd m <- yup, you guessed it, Tab here also until you see "My
Documents", hit enter

This should get you to your My Documents folder. This is a shortcut where
all you have to do is type cd then the first letter of the folder and hit Tab
until you see the folder you want. This also works for (and is very very
handy for) working with files with long names - so that you don't have to do
something like: del wiiambvknaiidmcoocaniiel_847763829947784_fiujiqmviif.dat
to delete a file with a really long and annoying name. In this case you would
only have to do this: del w (hit Tab as many times as it takes for this file
to come up) and hit enter.

-Dan
 
LittleMoo said:
Lets try something that a tiny bit different here...

Get the Command Prompt up - make sure you are in the C drive if not type
in
'C:' without the single quotes and hit enter. If you're not in the C drive
this will put you into C's root.

If you are in the C drive go to the root - do a 'cd \' and hit enter
(that's
a cd with a space and then a \). Now you will be in the root of the drive.

From here to make it a little easier to traverse through directories -
instead of having to worry about spaces and long file or folder names -
without putting the c:\ at the beginning do this:
cd d <- from here keep hitting the Tab key until you see
"Documents and Settings" and hit enter
cd d <- keep hitting Tab again until you see dave and hit enter
cd m <- yup, you guessed it, Tab here also until you see "My
Documents", hit enter

This should get you to your My Documents folder. This is a shortcut where
all you have to do is type cd then the first letter of the folder and hit
Tab
until you see the folder you want. This also works for (and is very very
handy for) working with files with long names - so that you don't have to
do
something like: del
wiiambvknaiidmcoocaniiel_847763829947784_fiujiqmviif.dat
to delete a file with a really long and annoying name. In this case you
would
only have to do this: del w (hit Tab as many times as it takes for this
file
to come up) and hit enter.

-Dan

NICE WORK !!!
you get my tip of the month award for this ;-)

rgds
Roberto
 
DH said:
thanks but ""Invalid switch - /d"

Dave H.

You started this by saying that you are at the "command prompt". Are you
using the "cmd.exe" or "command.com" command prompt? The CD command in
cmd.exe has a /d switch. The CD command in command.com does not. The
"default" command prompt on my system uses "cmd.exe". I use classic menus
in my account so it is at Start->Accessories->Command Prompt->Properties.
Target is %SystemRoot%\system32\cmd.exe and Start in is
%HOMEDRIVE%%HOMEPATH%.

I hope that helps.

Paul
 
Invalid switch- /d"dave"\my

Really, really strange. The "/d switch works just fine here. And when
I type "cd /?" to get the help stuff, it talks about the /d switch.

Hmm...looking at that error message again, it looks like you haven't
left a space after the switch. The command should something like this:

cd /d c:\winnt

with a space between the /d switch and the path that you want to
switch to.
 
LittleMoo said:
Lets try something that a tiny bit different here...

Get the Command Prompt up - make sure you are in the C drive if not type in
'C:' without the single quotes and hit enter. If you're not in the C drive
this will put you into C's root.

If you are in the C drive go to the root - do a 'cd \' and hit enter (that's
a cd with a space and then a \). Now you will be in the root of the drive.

From here to make it a little easier to traverse through directories -
instead of having to worry about spaces and long file or folder names -
without putting the c:\ at the beginning do this:
cd d <- from here keep hitting the Tab key until you see
"Documents and Settings" and hit enter
cd d <- keep hitting Tab again until you see dave and hit enter
cd m <- yup, you guessed it, Tab here also until you see "My
Documents", hit enter

This should get you to your My Documents folder. This is a shortcut where
all you have to do is type cd then the first letter of the folder and hit Tab
until you see the folder you want. This also works for (and is very very
handy for) working with files with long names - so that you don't have to do
something like: del wiiambvknaiidmcoocaniiel_847763829947784_fiujiqmviif.dat
to delete a file with a really long and annoying name. In this case you would
only have to do this: del w (hit Tab as many times as it takes for this file
to come up) and hit enter.

-Dan

It's even easier than that. Once you type:

cd d <tab>

and have "Documents and Settings" displayed, backspace over the
double-quote and add a backslash. Now press <tab> again, and the next
level of directories will cycle and be appended to what you've already
typed. It's a great, GREAT feature of the command prompt!

mhc
 
Back
Top