Guides:Shells/COMMAND.COM-CMD.EXE/DOS Commands/CD,MD,RD

From CoderGuide

Jump to: navigation, search

Return to: Guides:Shells/COMMAND.COM-CMD.EXE/DOS_Commands

CD (chdir), MKDIR (md), RMDIR (rd)

Format:

cd
cd path
mkdir dir
rmdir dir

mkdir and rmdir are pretty straight forward. Give it the name of a directory to create or remove, and they'll do it. rmdir requires that the directory be empty before it can be removed.

DOS chose to keep the name of these commands the same as in Unix, with extra names for them. The "Format" section shows the names for these commands that are shared by both DOS and Unix (hence, why we show them here in lower case).

CD, when used with no parameters, prints the current path. If you specify a drive, then it will print the current working directory of that drive.

If you give it a directory, then it change the current working directory.

Example:

C>PROMPT $p$g
C:\WINDOWS>CD \
C:\>CD
C:\
C:\>mkdir t
C:\>cd t
C:\T>cd d:\
C:\T>d:
D:\>cd c:
C:\T
D:\>cd c:\
D:\>rmdir c:\t
Personal tools