Cd command
CD (change directory) is a command used to switch directories in MS-DOS and the Windows command line.
Availability
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
Cd syntax
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.
The CHDIR command does not treat spaces as delimiters. To change to a subdirectory name containing a space, there is no need to surround the subdirectory 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 must type if extensions were disabled.
Windows 98 and earlier syntax
CHDIR [drive:][path] CHDIR[..] CD [drive:][path] CD[..]
Cd examples
cd\
Goes to the highest level (the root) of the drive.
cd..
Moves back one directory. For example, if you are in the C:\Windows\COMMAND> directory and type the command above, it takes you to C:\Windows> directory.
With Windows 95 and later, use more than two periods to go back more than one directory. For example, typing cd... (three periods) takes you back two directories (if possible) instead of only one directory.
cd windows
If this directory is available in the current directory, it takes you to 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.
To see what directories are available in the directory you're currently in, use the dir command.
cd\windows
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.
cd\windows\system32
If this directory is available, it changes to 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 to the pics directory.
cd
Typing cd alone prints the working directory. For example, if you're in c:\windows> and you type cd, it prints "c:\windows." For users who are familiar with Unix or Linux, it's similar to using the pwd (print working directory) command.