Changing directory in command prompt



Peter Aitken
07-09-2005, 11:53 PM
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?
--
Peter Aitken

Remove the crap from my email address before using.

Mary Patricia
07-09-2005, 11:53 PM
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".

Tom Porterfield
07-09-2005, 11:53 PM
Peter Aitken wrote:
> 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.

Steve Winograd [MVP]
07-09-2005, 11:53 PM
In article <u8a2y1fZFHA.2768@tk2msftngp13.phx.gbl>, "Peter Aitken"
<paitken@CRAPnc.rr.com> wrote:
>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

Ramesh, MS-MVP
07-09-2005, 11:53 PM
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

--
Ramesh, Microsoft MVP
Windows XP Shell/User
http://windowsxp.mvps.org


"Peter Aitken" <paitken@CRAPnc.rr.com> wrote in message
news:u8a2y1fZFHA.2768@tk2msftngp13.phx.gbl...
>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?
> --
> Peter Aitken
>
> Remove the crap from my email address before using.
>

Ramesh, MS-MVP
07-09-2005, 11:53 PM
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.

--
Ramesh, Microsoft MVP
Windows XP Shell/User
http://windowsxp.mvps.org


"Peter Aitken" <paitken@CRAPnc.rr.com> wrote in message
news:u8a2y1fZFHA.2768@tk2msftngp13.phx.gbl...
>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?
> --
> Peter Aitken
>
> Remove the crap from my email address before using.
>

Keith S
07-09-2005, 11:53 PM
"Peter Aitken" <paitken@CRAPnc.rr.com> wrote in message
news:u8a2y1fZFHA.2768@tk2msftngp13.phx.gbl...
>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?
> --
> Peter Aitken
>
> Remove the crap from my email address before using.


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

Steve N.
07-09-2005, 11:53 PM
Peter Aitken wrote:

> 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

Stan Brown
07-09-2005, 11:53 PM
On Tue, 31 May 2005 12:26:02 -0400, "Peter Aitken"
<paitken@CRAPnc.rr.com> wrote:

>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"


--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"I feel a wave of morning sickness coming on, and I want to
be standing on your mother's grave when it hits."

Byte
07-09-2005, 11:53 PM
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
--
Some days you're the windshield,
some days you're the bug.


"Peter Aitken" wrote:

> 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?
> --
> Peter Aitken
>
> Remove the crap from my email address before using.
>
>
>


Changing directory in command prompt