CD / CHDIR – DOS Command

It is used to display the name of a current directory. Also it is helpful command used to change current directory.

To view ‘chdir or cd’ command with its all possible parameters you can use following command. Its like help information to regarding that command.

chdir/?
OR
cd/?

Syntax :

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

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

Use 1:

chdir /d “D:\Tutorials\Web\ASP”

– It will change directory directly to “D:\Tutorials\Web\ASP” from another drive’s current directory.

Output 1:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

E:\> chdir /d D:\Tutorials\Web\ASP

D:\Tutorials\Web\ASP > _

Use 2:

chdir..

– It will go back one directory i.e. upto “D:\Tutorials\Web”.

Output 2:

D:\Tutorials\Web\ASP> chdir..

D:\Tutorials\Web> _

Use 3:

chdir\

– It will go to root of the current drive. i.e. on D:\.

Output 3:

D:\Tutorials\Web\> chdir\

D:\> _

Use 4:

chdir

– It returns current path of drive.

Output 4:

D:\> chdir
D:\

D:\> _

Use 5:

cd /d C:\Test\Colors\Green

– It will change directory directly to “C:\Test\Colors\Green” from another drive’s current directory.

Output 5:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\> cd /d C:\Test\Colors\Green

C:\Test\Colors\Green> _

Use 6:

cd..

– It will go back one directory i.e. upto C:\Test\Colors.

Output 6:

C:\Test\Colors\Green> cd..

C:\Test\Colors> _

Use 7:

cd\

– It will go to root of the current drive. i.e. on C:\.

Output 7:

C:\Test\Colors> cd\

C:\> _

Use 8:

cd

– It returns current path of drive.

Output 8:

C:\> cd
C:\

C:\> _

Leave A Comment

Your email address will not be published. Required fields are marked *