Changing directory in command prompt

P

Peter Aitken

I need to execute a command line program in a specific folder. I have used
Start, Run to open a command prompt but am having trouble using CD to change
to the proper folder. The problem is that the path includes spaces. Thus

CD program files

does not work nor does

CD "program files"

How can I get the command prompt to the proper folder?
 
M

Mary Patricia

You could try cd progr* which should work unless you have another folder in
the same parent directory with a name that also starts with "progr".
 
T

Tom Porterfield

Peter said:
I need to execute a command line program in a specific folder. I have used
Start, Run to open a command prompt but am having trouble using CD to change
to the proper folder. The problem is that the path includes spaces. Thus

CD program files

does not work nor does

CD "program files"

How can I get the command prompt to the proper folder?

Are you using command.com or cmd.exe? If using command.com you need to pass
it the 8.3 name of the folder. Ex:

cd progra~1

Better is to use cmd.exe where, where either of the two formats you have
listed above will work.
--
Tom Porterfield
MS-MVP Windows
http://support.telop.org

Please post all follow-ups to the newsgroup only.
 
S

Steve Winograd [MVP]

"Peter Aitken" said:
I need to execute a command line program in a specific folder. I have used
Start, Run to open a command prompt but am having trouble using CD to change
to the proper folder. The problem is that the path includes spaces. Thus

CD program files

does not work nor does

CD "program files"

That should work, provided that the command prompt window is open in
the parent folder. For example, if you want to go to C:\Program
Files, then the command prompt must show "C:\"
How can I get the command prompt to the proper folder?

A command prompt window typically opens in your user name's folder in
Documents and Settings. For example, mine opens in:

C:\Documents and Settings\Steve

To get to C:\Program Files, I can use either of these commands:

CD "C:\Program Files"
CD "..\..\Program Files"

The first one specifies a full path name including the drive letter.
The second one specifies a relative path name, using ".." to move up
one level at a time.
--
Best Wishes,
Steve Winograd, MS-MVP (Windows Networking)

Please post any reply as a follow-up message in the news group
for everyone to see. I'm sorry, but I don't answer questions
addressed directly to me in E-mail or news groups.

Microsoft Most Valuable Professional Program
http://mvp.support.microsoft.com
 
R

Ramesh, MS-MVP

Peter,

It depends on directory where you are in currently. Typing CMD in Run dialog
usually gets you to this location

X:\Documents and Settings\{username}

So you'll need to type this to change the Program Files directory.

CD\Program files
 
R

Ramesh, MS-MVP

If you're using command.com, then try this short file name

CD\Progra~1
(Program files is usually "Progra~1" )

You may use DIR /X to view the file/folder names' short path.
 
K

Keith S

Peter Aitken said:
I need to execute a command line program in a specific folder. I have used
Start, Run to open a command prompt but am having trouble using CD to
change to the proper folder. The problem is that the path includes spaces.
Thus

CD program files

does not work nor does

CD "program files"

How can I get the command prompt to the proper folder?


Try "CmdherePowertoy" from Microsoft .It's a breeze.
 
S

Steve N.

Peter said:
I need to execute a command line program in a specific folder. I have used
Start, Run to open a command prompt but am having trouble using CD to change
to the proper folder. The problem is that the path includes spaces. Thus

CD program files

does not work nor does

CD "program files"

How can I get the command prompt to the proper folder?

Try

CD\program files

Steve
 
S

Stan Brown

I need to execute a command line program in a specific folder. I have used
Start, Run to open a command prompt but am having trouble using CD to change
to the proper folder. The problem is that the path includes spaces. Thus

CD program files

does not work nor does

CD "program files"

How can I get the command prompt to the proper folder?

Two methods:

(1) Set the "Start in" directory in the shortcut

or

(2) In the command prompt, give the full path:
cd "\program files"
 
G

Guest

cd\prog~files (sometimes or this) cd\program files
When you're at the C prompt, type cd\windows and press Enter.
Sometimes on long directory names XP uses a tilde (~). Just type the
directory as you see it and click Enter should get you to it.
Better yet, go to the below website for all DOS commands in XP. Scroll down
some and it will show you how to enter the commands.
Windows XP DOS Commands
http://www.fsref.com/pr/dosxp.htm
 

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