windows 10 cmd prompt change directory to drive on different physical harddrive

2

1

I am a Windows noob here (coming from a linux background.) I am having a problem in the cmd prompt changing to a directory on a different drive. Either I haven't found any suitable answers for this particular scenario or I'm not searching with the correct terms. Here is the scenario...

I am on C:\ and I want to change to a directory say E:\specific\directory.

I know about the /E switch for cd, but it's not working in this case. More, I have C:\ and D:\ on an SSD and my E:\ is on an HDD, so they're on two different physical harddrives.

I can do

C:\> cd /D D:\specific\directory with no problem, but trying to

C:\> cd /E E:\specific\directory

I get the error The filename, directory name, or volume label syntax is incorrect.

The only way it lets me on the E:\ drive is with two commands i.e. if I do C:\> e: first, then it lands on the E:\ drive, then with a second cd command I can navigate to whatever directory I want on E:\. So is there any way that I can navigate from C:\ to a specific directory on E:\ in one command rather than two?

Thanks!

crob

Posted 2018-04-12T14:35:00.820

Reputation: 23

Incidentally, you should bookmark SS64 on CMD as an excellent on-line reference for the Windows command line - Windows still doesn't have a useful man(1) command...

– Jeff Zeitlin – 2018-04-12T14:43:16.860

You could use Linux on Windows 10. See Install the Windows Subsystem for Linux.

– harrymc – 2018-04-12T15:01:46.910

Thank you @JeffZeitlin and EBGreen for your answers. However, I think you both may have missed a small detail in my question, and I also figured out what my problem was. I was using the command C:\> cd /E E:\specific\directory where I thought the switch flag was to use the letter for which drive you wanted to switch to, i.e. switch /E for the E:\ drive. But no, the actual flag is /D, so the command should be C:\> cd /D E:\specific\directory. – crob – 2018-04-12T15:02:55.463

I was just about to post that, crob - I've been a DOS user since the 80's and I did not know about the /d option until just now after doing a cd /? and reading the help and testing it out myself. Learned something new. – Bill Hileman – 2018-04-12T15:08:59.693

That is literally what @JeffZeitlin has in his answer – EBGreen – 2018-04-12T15:55:56.130

Answers

8

The /D switch is what you should be using. Per SS64 on CD, CD /D ... changes both drive and directory - regardless of what drive you are attempting to change to - so you would use CD /D E:\Specific\Directory.

Jeff Zeitlin

Posted 2018-04-12T14:35:00.820

Reputation: 2 918

3

As Jeff Zeitlin pointed out, you can use the /D switch however I would highly suggest using Powershell instead of cmd anyway. It is intended to be the replacement for cmd and in it this:

cd E:\specific\directory

Gives the behavior that you want. It also comes with some aliases that sort of "emmulate" *nix commands such as ls to make it a "little" more friendly to people making the transition to a windows shell.

EBGreen

Posted 2018-04-12T14:35:00.820

Reputation: 7 834

I agree with the preference for PowerShell over cmd; however, it's not unusual for people to be irritated at answers to "how do I do this" being "don't do that, do this instead". I consider using aliases like cd or ls to be fraught with peril, however, because while they do analogous things in PowerShell, they don't work the same way - ls might be OK, but ls -al isn't going to work as expected. – Jeff Zeitlin – 2018-04-12T14:46:49.550

2Well, I can't control whether someone is irritated with my answer or not. As for aliases not exactly emmulating the nix equivalent that is why little is in italics. – EBGreen – 2018-04-12T14:51:40.863