SoFunction
Updated on 2025-04-08

Usage of cd command in dos command line

Show the current directory name or change the current directory.

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

.. Specifies to be changed to the parent directory.

Type CD drive: Displays the current directory in the specified drive.
Type just a CD without parameters, and the current drive and directory are displayed.

Using the /D switch, in addition to changing the current directory of the drive,
The current drive can also be changed.

If the command extension is enabled, CHDIR will change as follows:

The current directory string is converted to use case on the disk name. so,
If the case is the case on the disk, CD C:\TEMP will set the current directory to
C:\Temp。

The CHDIR command does not treat spaces as delimiters, so it is possible to change the directory name to a
Subdirectory name with spaces but without quotes. For example:

cd \winnt\profiles\username\programs\start menu

Same as the following:

cd "\winnt\profiles\username\programs\start menu"

In case of extension deactivation, you must type the above command.


cd\ 'Return to root directory
cd.. 'Return to previous directory

For example:

Welcome word at the beginning
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Install ant successfully

C:\Documents and Settings\wzy>
Buildfile: does not exist!
Build failed

Enter "cd\" at the end of the directory

C:\Documents and Settings\wzy>cd\

The directory is located in the root directory and enter "cd android dvp"

C:\>cd android dvp

After entering the carriage, the directory is located at C:\android dvp>, and continue to enter "cd ZXing-1.6"

C:\android dvp>cd ZXing-1.6

After entering the carriage, the directory is located at C:\android dvp\ZXing-1.6>, and continue to enter "cd core"

C:\android dvp\ZXing-1.6>cd core

After entering the carriage, the directory is located at C:\android dvp\ZXing-1.6\core>

If you enter "cd.."

C:\android dvp\ZXing-1.6\core>cd..

After entering the car, the directory is backed a layer and then enter "cd\"

C:\>cd android dvp\ZXing-1.6>cd\

After entering the car, the directory returns to the root directory again. At this time, enter "cd android dvp\ZXing-1.6\core"

C:\>cd android dvp\ZXing-1.6\core

After entering the car, the directory will be positioned at the target location "C:\android dvp\ZXing-1.6\core>" at one time.

C:\android dvp\ZXing-1.6\core>