MS-DOS and Windows command line cd command
CD (change directory) is a command used to switch directories in MS-DOS and the Windows command line.
CD is an internal command available in the following Microsoft operating systems:
- All Versions of MS-DOS
- Windows 95
- Windows 98
- Windows ME
- Windows NT
- Windows 2000
- Windows XP
- Windows Vista
- Windows 7
- Windows 8
- Windows 10
- Windows 11
Windows XP and later syntax
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 set the current directory to C:\Temp if that is the case on disk.
CHDIR command does not treat spaces as delimiters, to CD into a subdirectory name containing a space without surrounding the name with quotes. For example:
chdir \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.
Windows 98 and earlier syntax
CHDIR [drive:][path] CHDIR[..] CD [drive:][path] CD[..]
Goes to the highest level (the root) of the drive.
Moves back one directory. For example, if you are in the C:\Windows\COMMAND> directory and type the above command it would take you to C:\Windows> directory.
With Windows 95 and later, you can go back more than one directory when using more than two periods. For example, typing cd... (three periods) would take you back two directories (if possible) instead of only one directory.
If this directory is available in the current directory, it takes you into the Windows directory. The directory name "Windows" can be substituted with any other directory name and in MS-DOS and the Windows command line capitalization is not important.
If at any time you need to see what directories are available in the directory you're currently in, use the dir command.
If this directory is available, it would first move back to the root of the drive and then go into the Windows directory. The C:\Windows directory is the default install directory, so on almost all computers this directory should be valid.
If this directory is available, it changes into the system32 directory, a subdirectory of the Windows directory.
cd /d e:\pics
For example, if you were on the C: drive, using the /d option switches to the E: drive and then moves into the pics directory.
Typing cd alone prints the working directory. For example, if you're in c:\windows> and you type the cd it prints "c:\windows." For those users who are familiar with Unix or Linux, this could be thought of as doing the pwd (print working directory) command.