CMD cd to other drives except C:\ not working

77

19

Possible Duplicate:
Using cd Command in Windows Command Line, Can't Navigate to D:\

I am unable to cd D:\ or cd D: or to any other drives. I am facing this problem from last 2 months but until now cmd was not that important to me.

I have checked multiple times with 2-3 anti-virus but it doesnt show any, and according to me there shouldnt be, because I visit only a few top sites, use genuine software and plug only my usb drive in PC.

This is what happens when I try to cd
cmd screenshot

Shishant

Posted 2011-06-26T19:00:45.313

Reputation: 1 095

Question was closed 2011-07-23T20:00:54.993

1While the question has been answered, a neat upshot of this is that different drives maintain different working directories - and you can refer to them by the drive letter! copy aFile e: will copy aFile to e:'s working directory, for example. – Phoshi – 2011-06-26T22:07:35.593

The irony, Phoshi, is that in Windows NT, including Windows NT version 6.1 as in the question, that is not the case for the operating system proper. There's only one current directory for a process. The old MS/PC/DR-DOS semantics of separately maintained working directories for each drive are emulated (but not exactly) via a system of hidden environment variables. – JdeBP – 2011-06-27T10:48:15.617

It is indeed true, that there are (even if emulated) multiple current directories. For further information read this nice article http://blogs.msdn.com/b/oldnewthing/archive/2010/10/11/10073890.aspx by Raymond Chen

– HalloDu – 2011-06-27T13:28:02.137

It’s not surprising or ironic, it’s because Windows and DOS have completely different interfaces. Yes every process (even in DOS) gets a single item in response to a GWD command, but otherwise Windows and DOS function very differently. You can’t printf from a non-console Windows program either. ;-) – Synetech – 2011-06-28T00:45:56.777

Answers

149

You do not need to cd d:\ just enter d:.

CD stands for change directory, which is not what you want to do.

Greg

Posted 2011-06-26T19:00:45.313

Reputation: 3 614

Thanks just realized I need to throw away ui for few days – Shishant – 2011-06-26T19:37:13.097

3> CD stands for change directory, which is not what you want to to. Except that in Windows, the CD command does have an option to change drive. – Synetech – 2011-06-26T21:30:11.677

@Synetech, that feature is recent in the history of Dos and Windows. It isn't in any version of COMMAND.COM, for example. My shaky recollection is that it wasn't in the earliest CMD.EXE from NT 3.1 either, but I can't put my hands on documentation to prove that easily right now. – RBerteig – 2011-06-26T22:11:32.733

3It’s not that recent; it’s in at least W2K. Regardless, the question is about Windows 7, so command.com is irrelevant and the /d switch is definitely there. – Synetech – 2011-06-26T22:16:59.250

@Berteig, that feature is recent in the history of Dos and Windows. It isn't in any version of COMMAND.COM, for example   Also, the OP wasn’t using DOS, the question is about Windows 7, so the history of CD was irrelevant here; that switch was available. – Synetech – 2013-11-30T16:06:09.073

54

Use one of the following:

C:\Ruby\bin> cd /d D:\
D:\>

or

C:\Ruby\bin> cd D:\
C:\Ruby\bin> D:
D:\>

Synetech

Posted 2011-06-26T19:00:45.313

Reputation: 63 242

cd /d "D:\abc\your_directory" – Raju yourPepe – 2019-09-19T09:45:36.030

@RajuyourPepe, Yes. I agree. In fact, I agree so much, I agreed with you almost 8.5 years in advance, in anticipation of your comment. – Synetech – 2019-09-20T12:47:26.997

I have just done a scratch search for this and tried – Raju yourPepe – 2019-09-20T12:57:44.070

5And, don't forget put " around path if there are spaces in it: cd "D:\My Documents\My Music\A Band\An Album" – LiuYan 刘研 – 2011-06-26T19:27:22.557

2@Liu, you don't always need to bother, for example cd /d C:\program files\Microsoft Office works fine for me from D: on a Win XP cmd instance. It is however, a really good habit to get in to, otherwise one day you'll use another application that cannot handle paths given as arguments that aren't enclosed. – DMA57361 – 2011-06-27T10:23:05.203

That works because the CD command expects a single path argument (it does not take multiple directories). Therefore it interprets everything (other than the /d switch) as a single path, including spaces. That’s why if you use the auto-completion character (defaults to TAB) with CD, it only selects directories, while with other commands (eg dir, copy, etc.), it selects files and directories together. Like DMA57361 said, CD knows what it does and understands its arguments, so it handles them— or rather it —intelligently. (Were that all programs would do so. *sigh*) – Synetech – 2011-06-28T00:35:56.660

Ah, see Raymond says the same thing in the blog entry that HalloDu links to above. – Synetech – 2011-06-28T00:46:23.937