The syntax and usage of selected DOS internal commands, including: TIME,
DATE, CLS, DIR, COPY, TYPE, DEL, REN, RD, MD, CD, PATH, and SET PROMPT.
DOS Internal Commands
The DOS (Windows 9x) internal commands are so-called because their
instructions are a part of COMMAND.COM, the DOS (Windows 9x) command processor.
Recall that COMMAND.COM is placed into memory each time the DOS or Windows
9x OS is booted. Therefore, the internal commands are always in memory and
can always be executed from any command line prompt.
This is in contrast to the disk-bound external commands, which reside in
secondary memory up until the moment they are needed, at which time the
OS must find them and load them into primary memory.
The syntax for some frequently used internal commands follows.
Displays current time and allows it to be changed.
Displays current date and allows it to be changed.
Clears the screen.
Shows directory information of a diskette: name, size, and the
date and time stamp of files.
/p Display dir info and pauses display when the screen is full
/w Display names and extensions only in five columns
To display a file directory listing for D:\DATA\LETTER\ANNUAL from
different current directories:
D:\DATA> DIR LETTER\ANNUAL
C:\WINDOWS> DIR D:\DATA\LETTER\ANNUAL
Copies a file. Name of copy may be the same as original, or different.
COPY [d:][path][name.ext] [d:][path][name.ext]
/v Verify, copies the file and compares it with the original
/b Binary file
To copy a file from D:\BATCH to the root of A: drive
A:\> COPY D:\BATCH\CL.BAT (from A: drive)
D:\BATCH> COPY CL.BAT A:\ (from D:\BATCH)
To copy a file from the root of C: to A: drive and change its name
A:\> COPY C:\MSDOS.SYS MSDOSSYS.BAK (from A:)
C:\> COPY MSDOS.SYS A:\MSDOSSYS.BAK (from the root of C:)
To copy all of the files from the root of A: to D:\CCV\ENGCOMP
A:\> COPY *.* D:\CCV\ENGCOMP (from A:)
D:\CCV\ENGCOMP> COPY *.* A:\ (from D:\CCV\ENGCOMP)
Displays the contents of a file.
To display the contents of the file MY.LET to the screen
A:\> TYPE MY.LET
Deletes a file from disk.
To delete one file:
A:\> DEL A:\MY.LET
To del all files in current directory
A:\> DEL *.*
Renames a file.
REN [d:][path][name.ext] [d:][path][newname.ext]
To change the name of the file D:\LET\ANNUAL\99.DOC to 1999.DOC
D:\LET> REN ANNUAL\99.DOC 1999.DOC (from D:\LET)
D:\DATA> REN \LET\ANNUAL\99.DOC 1999.DOC (from D:\DATA)
C:\WINDOWS> REN D:\LET\ANNUAL\99.DOC 1999.DOC (from C:\WINDOWS)
Makes (creates) a new directory.
To create a directory named HERMIT in the root of D: drive
D:\> MD HERMIT (from D:\)
C:\> MD D:\HERMIT (from C:\)
Removes an existing directory (directory must be empty).
To remove the HERMIT sub-directory:
D:\> RD HERMIT (from D:\)
C:\> RD D:\HERMIT (from C:\)
Changes the current directory.
To make D:\HERMIT the current directory
D:\> CD HERMIT (from D:\)
D:\DATA> CD \HERMIT (from D:\DATA)
D:\DATA\SOURCE> CD \HERMIT (from D:\DATA\SOURCE)
D:\DATA\SOURCE> CD .. (from D:\DATA\SOURCE)
The PATH command is used to help the command interpreter find
external commands which are not in the current directory. The
command interpreter looks into the
DOS environment for "PATH=" and then searches the
paths (each separated from the next by a semicolon) that follow.
To set the DOS PATH:
To display the current path:
Used to specify the appearance of the DOS prompt.
SET PROMPT= (from the command line)
PROMPT= (in a batch file)
DOS PROMPT Characters
$b | $d system date
$e esc char $g >
$h destructive bk space $i <
$n default drive $p full path description
$q = $t system time
$v DOS version no $_ CR and LF
$$ the $ sign
To display current drive & current path followed by ">" as prompt
To display the current date, time, and drive on separate lines
SET PROMPT $D$_$T$_$N$G
To redefine F9 to CD\Windows\Start Menu\Programs\Startup
SET PROMPT $e[0,67;"'CD\Windows\Start Menu\Programs\Startup'";13p
Bruce Miller, 2002
DOS Articles Index
All Articles Index