# I can't navigate to my SD card directory using cmd in windows [duplicate]

I have a surface pro 3 with a 32gb SD card. I've set the OneDrive location to this SD card (since they removed the placeholder feature and so I am forced to download everything). The drive letter assigned to the SD card is D:\, verified by disk management utility.

The problem is that I am unable to acces this drive/card with command line - both regular and admin elevated. ie, the command cd D:\ simply just returns nothing and stays in the current folder.

This is causing quite a few command line tools to break on my computer as it dosnt return an error (but nothing seems to work).

The answer marked below is correct. However, for more information try CMD cd to other drives except C:\ not working

Just type this command

D:


or

D:\


This will switch to the drive

• That works, but why dosnt cd work? Some of my extensions/tools create a path dynamically which have cd built into them. I don't want to end modifying extensions, that's a bit tedious – masfenix May 13 '16 at 0:56
• I've updated my question to a duplicate I found. Should've searched first. – masfenix May 13 '16 at 0:58
• Its just a weird way windows decides to do it.... I dunno :| – f3rn0s May 13 '16 at 1:17
• @masfenix: As for why it doesn't work and what's the reasoning behind all this, see my answer below – CherryDT May 13 '16 at 8:23
• @masfenix, The cd command in windows has a drive and a path. The cd d:\foo\bar changes only the path, but keeps the same drive. The command cd /d:\foo\bar does what you want and changes both the drive and the path. – PatS Aug 2 '20 at 16:14

Windows has the concept of per-drive current paths, at least in the shell. This is from the old days where you might have been working with two floppy disks and have different folders open in them and you were switching between them. And actually, subfolders were only introduced in DOS 2.0, I believe, and before that there were only different drives and no backslashes and no cd.

Therefore, switching drives is done like this:

C:\> D:

D:\>


...while changing one of the current directories is done using cd like this:

D:\> cd relative_folder

D:\relative_folder> cd D:\absolute_folder

D:\absolute_folder>


It is possible to change the directory on another drive without switching to that drive, and this is what you were accidentally doing:

D:\absolute_folder> cd C:\test

D:\absolute_folder> C:

C:\test> D:

D:\absolute_folder>


It is also possible to refer to the current path of another drive by just specifying the drive letter without backslash:

D:\absolute_folder> dir C:
Directory listing of C:\test
...

D:\absolute_folder> dir C:hello
Directory listing of C:\test\hello
...

D:\absolute_folder> dir C:\
Directory listing of C:\
...

D:\absolute_folder>


And the solution to your problem: In modern Windows, the cd command has a switch /d to implicitly switch drives as well:

D:\absolute_folder> cd /d C:\something

C:\something>


Side note: the current paths for the individual drive (for the current process - current paths are per process!) are stored as magic hidden environment variables called =C:, =D: etc.

You can't assign them normally due to the equal sign, but you can view them using echo %=C:% and such or by listing all environment variables including hidden ones using a hack (note the doublequote):

C:\something> set "
=C:=C:\something
=D:=D:\absolute_folder
...


You can also see the current path of another drive using cd with a drive letter without any path:

C:\something> cd D:
D:\absolute_folder

C:\something>


• Thank you. I was able to modify my tools and extensions (that run off C and call cd to include the /d flag. – masfenix May 13 '16 at 21:26