The Hermit Hermit's Free Library  MS-DOS

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-named because their instructions are a part of COMMAND.COM, the DOS (Windows 9x) command processor, and COMMAND.COM is loaded into primary 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 every DOS 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. Only then are they loaded into primary memory, providing that the operating system can find them on disk.

The syntax for some frequently used internal commands follows.

TIME

Displays current time and allows it to be changed.
Syntax: TIME

DATE

Displays current date and allows it to be changed.
Syntax: DATE

CLS

Clears the screen.
Syntax: CLS

DIR

Shows directory information of a diskette: name, size, and the date and time stamp of files.
Syntax: DIR [d:][path]
Optional switches:
/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\LETTER\ANNUAL> DIR
D:\DATA> DIR LETTER\ANNUAL
C:\WINDOWS> DIR D:\DATA\LETTER\ANNUAL

COPY

Copies a file. Name of copy may be the same as original, or different. Syntax: COPY [d:][path][name.ext] [d:][path][name.ext]
Optional switches:
/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)

TYPE

Displays the contents of a file.
Syntax: TYPE [d:][path][name.ext]

To display the contents of the file MY.LET to the screen
A:\> TYPE MY.LET

DEL

Deletes a file from disk.
Syntax: DEL [d:][path][name.ext]

To delete one file: A:\> DEL A:\MY.LET To del all files in current directory A:\> DEL *.*

REN

Renames a file.
Syntax: 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)

MD

Makes (creates) a new directory.
Syntax: MD [d:][path][dirname]

To create a directory named HERMIT in the root of D: drive D:\> MD HERMIT (from D:\)
C:\> MD D:\HERMIT (from C:\)

RD

Removes an existing directory (directory must be empty).
Syntax: RD [d:][path][dirname]

To remove the HERMIT sub-directory: D:\> RD HERMIT (from D:\)
C:\> RD D:\HERMIT (from C:\)

CD

Changes the current directory.
Syntax: CD [path][dirname]

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)

PATH

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.
Syntax: PATH=[path;path;...]

To set the DOS PATH: PATH=C:\DOS;C:\PCW;\C:\BIN To display the current path: PATH

SET PROMPT

Used to specify the appearance of the DOS prompt.
Syntax: 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 SET PROMPT=$P$G 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