Microsoft DOS cd command
CD (Change Directory) is a command used to switch directories in MS-DOS and the Windows command line.
The CD command is an internal command and is available in the below 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 XP and later syntax
CHDIR [/D] [drive:][path]
CD [/D] [drive:][path]
.. 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 that contains 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
Goes to the highest level, the root of the drive.
Goes back one directory. For example, if you are in the C:\Windows\COMMAND> directory and typed the above command, this would take you to C:\Windows> directory.
Windows 95, 98, and later versions have a feature in the CD command that allows you to go back more than one directory when using the dots. For example, typing: "cd..." with three dots after the cd would take you back two directories.
If this directory is available in the current directory, it will take you into the Windows directory. Windows can be substituted with any other directory name.
If this directory is available, it would first move back to the root of the drive and then go into the Windows directory.
If this directory is available, it will move into the system32 directory located in the Windows directory. If at any time you need to see what directories are available in the directory you're currently in, use the dir command.
cd /d e:\pics
If for example, you were on the C: drive, typing the above command with the /d option would first switch the E: drive letter and then move into the pics directory.
Typing cd alone will print the working directory. For example, if you're in c:\windows> and you type the cd it will print 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.