2

Hi presently I am using command prompt frequently. Every time I need to access different folders of different drives so I need to change drive and directory at the same time For this I got a solution: C:> CD /D D:\JAVA it's working fine. But why we are using "/D"

So please explain me why we are using /D.

Stack User
  • 69
  • 1
  • 9
  • 1
    /D implies switching both drive and folder simultaneously. [This question](http://stackoverflow.com/questions/18309941/what-does-it-mean-by-command-cd-d-dp0-in-windows) covers the subject further. In addition, try google next time. You could have found the answer to this question in five minutes max. I'm not being critical but offering some professional advice. :) – CalebB Apr 16 '15 at 05:18
  • Thank you CalebB I'll try google next time.....Thank you – Stack User Apr 16 '15 at 05:28

3 Answers3

4

CD /D ... changes the current drive in addition to changing folder.


Source CD Change Directory - Select a Folder (and drive)

Syntax

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

Key

/D : change the current DRIVE in addition to changing folder.

...

Changing the Current drive

Enter the drive letter followed by a colon.

C:> E:
E:>

To change drive and directory at the same time, use CD with the /D switch.

C:> cd /D 
E:\utils E:\utils\>
DavidPostill
  • 7,734
  • 9
  • 41
  • 60
1

cd /? Will answer that for you.

The alternative to cd /d d:\java is d: then cd java. If you then changed to another drive (say C:) and ran dir d: you would still see the contents of the java directory. i.e. The OS remembers what directory each drive is currently looking at. Likewise you can just run C:>cd d:\otherDir c:>dir d: and see the contents of otherDir.

Scott C
  • 1,660
  • 1
  • 11
  • 18
0

By using the command -

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

on cmd it means to jump to a different directory where /D simply means to jump to another directory. This command also gives freedom in using different drives unlike the cd [drive:][path] command.

By using the above command it is also possible to move to the same previous working directory in a specific Drive just by writing Drive name followed by a colon. For eg:

C:\Users>cd /D G:\FUN

G:\FUN>C:

C:\Users>
OM Bharatiya
  • 1,840
  • 14
  • 23