Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Change Directory in Command Prompt

12 Feb 2011   #1
QuackPot

Windows 7 Professional x64
 
 
Change Directory in Command Prompt

Anyone know how to do this in command prompt?

I type "cd .." a few times to get to to C:\

Then when I type "cd e:\" I see E:\ below the command line but I'm still in C:\.


Can anyone help?

Edit: Nevermind, manage to get it working. Just had to type "E:" instead of using CD beforehand. So used to linux.


My System SpecsSystem Spec
.

12 Feb 2011   #2
Bill2

Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
 
 

CD command is only meant to change directories, not drives. If you want to change to drive E: , just type E: at the prompt.
My System SpecsSystem Spec
12 Feb 2011   #3
Kari

Microsoft Community Contributor Award Recipient

 

Exactly as Bill told here above. Here a bit more information.

CD (change directory) can be used to change the current, active folder (directory as it was called long time ago ) of either the current drive or another drive. If you use CD command to change active folder in another drive than where you currently are, the change can be seen next time you change the active drive.

Some examples here in the screenshot:

-cd_parameters_2.png

(Click to enlarge)

Kari


My System SpecsSystem Spec
.


12 Feb 2011   #4
logicearth

Windows 10 Pro (x64)
 
 

use the /D switch with CD to change the drive along with the path.
Code:
> cd /?
Displays the name of or changes the current directory.

CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]

  ..   Specifies that you want to change to the parent directory.

Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.

Use the /D switch to change current drive in addition to changing current
directory for a drive.

If Command Extensions are enabled CHDIR changes as follows:

The current directory string is converted to use the same case as
the on disk names.  So CD C:\TEMP would actually set the current
directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, so it is possible to
CD into a subdirectory name that contains a space without surrounding
the name with quotes.  For example:

    cd \winnt\profiles\username\programs\start menu

is the same as:

    cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.
You can read about why this behavior exists here: http://blogs.msdn.com/b/oldnewthing/.../10073890.aspx

Alternatively you could update to PowerShell which is a lot more advance and newer.
My System SpecsSystem Spec
Reply

 Change Directory in Command Prompt




Thread Tools





Similar help and support threads
Thread Forum
Change Command Prompt Default Directory
This is a simple registry hack to change the default directory you see when opening command prompt. I like to have it set to the OS root drive, but you can change it to whatever you like. This will keep you from having to use the "change directory" switch every time you open command prompt, which...
Customization
How do I change system attribute for all folders using command prompt?
Let me share the background quickly. I work at a school as Computer Applications Technology teacher. The students bring homework to school on their flashdrives, and though we have good antivirus software at school, the viruses on their home PC's will often do considerable damage to the data on...
Performance & Maintenance
Run administrative command prompt from command prompt
Ok So I got myself into a unique bind here. I was trying to install some custom system files (for a theme) and I did it wrong and now I cant open explorer.exe . I dont want to goto a backup because this is a easy fix. (in my view). So I need to know how to run command prompt with administrative...
General Discussion
Cannot change drive in command prompt using CD
When I try to switch to D drive it stays in C: C:\Users\Valdis>cd d: D:\ C:\Users\Valdis>cd D:\Downloads C:\Users\Valdis>cd d: D:\Downloads
General Discussion
Change time to display OS from installation disk command prompt
Hey, how we all doing? I was stupid enough to manually delete my acronis files when I couldn't uninstall it the ordinary way. Now windows 7 gives a short BSOD after logo and computer restarts. Startup repair doesn't fix the problem, neither from my windows 7 usb or from laptop, I have...
Installation & Setup
Command Prompt to change primary monitor?
Hey, I'm working on a batch file to change a system's primary monitor before launching a game. Is there a DOS command to change the primary monitor on a system? Thanks!
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:10.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App