External DOS Commands
External commands are separate programs (.com or .exe) that perform tasks, not possible
with the shell commands.
For instance DEL can only delete files. Suppose you have a directory called "folder" that
contains many files and subdirectories, applying DEL folder would only delete files inside
"folder" directory, sub-directories and files inside sub-directories would remain intact.
Therefore an external command called DELTREE was created to do the job.
This command will delete all files and sub-directories.
DOS has many other external commands such as Format, XCopy,
move, considered by lots of people part of the command interpreter.
You know that a command is external if you find a file by its name.
e.g DELTREE is an executable program (deltree.exe) located inside Windows Command
CHOICE is used in Batch files programming and allows to specify a set of choices for the
user to choose from. More details when we review Batch file commands.
To delete an entire directory containing files and sub-directories
type DELTREE directoryname on the command line.
Fdisk lets you partition a brand new hard drive and configure it to run with DOS. Sometimes
you need to re-partition your hard drive after a virus infection. Type FDISK/status to
check your Hard Drive partition status.
After running Fdisk you'll need to format your hard drive so you can save files on it. Format
can be used with all sorts of disks (hard drives, floppies...) Although most floppies come
pre-formatted, it's sometimes necessary to format a floppy to erase all data and remove
viruses. Format is normally handled by Windows, but if the computer crashes you're only
left with DOS. Make sure you always keep a bootable diskette in a safe place. To make a
bootable floppy or startup disk, press Start>>Settings>>Control Panel then double-click
Add/Remove Programs, in the next window switch to "Startup Disk" tab and press
Create Disk... Follow the instruction, make sure the disk is empty. To format a disk from
DOS, type FORMAT A: at the command line, remember that everything on the disk will be
This command sets file attributes, in Windows you can set a file as Archive, Read-only, or
Hidden. In DOS you can do the same even set the file as a System file.
To see the file's attributes type ATTRIB filename
The command is quite easy to use, to set an attribute use (+) sign
to remove an attribute use (-)
R is for Read-only
A is for Archive
S is for System
H is for Hidden
e.g To set the attribute of myfile.txt to read-only and hidden
type ATTRIB +R +H myfile.txt
A utility that checks disks for errors.
Today Scandisk is used because it is more reliable.
Type CHKDSK to check your hard drive for errors, once again
I recommend using Scandisk.
Use this command to copy the content of one floppy to another. Windows users can right-
click the floppy, select Copy Disk...
Although we all use Windows in our daily computer tasks, but if one day you were in a
hurry, you'd better use DOS to copy your files.
With all the glory of Windows, DOS is faster !!
Type DISKCOPY a: b: to make a copy of your floppy content.
Use /V to double check the files that are copied.
The useful DOSKey is in fact an external command, DOSKEY.COM.
Type DOSKEY at command line to install the DOSKEY utility.
We will discuss the command's options later.
NOTE: When you exit the command prompt DOSKEY is Reset.
EDIT (edit.com, qbasic.exe)
Note: Both the file are required for EDIT
This is DOS Editor, EDIT.COM. To open any file with the editor,
type EDIT filename.
EDIT is a very handy program, quite easy to use. It has a search/replace feature plus
possibility to change layout like
background and Text color.
FC allows you to compare files and display differences between them, something Windows
cannot do. (Of course you can install a program to do the job more efficiently)
To compare two files simply type FC firstfile secondfile.
Searches for a text string in text file(s)
e.g FIND "word" c:\windows\file.txt will search for the string "word" inside file.txt
Puts a label on your drive or disk e.g LABEL A: (while having a floppy in drive a: ) will allow
you to specify a name for your floppy so it would appear when you apply DIR, You can use
up to 11 chars.
To display available memory on your system, type MEM.
Displays the content of a file to the screen then pauses and prints "more" at the end. Press
any key to continue printing the file content to the screen. e.g Suppose you've typed a
command and got a series of line scrolling and you didn't catch anything, just type | more
at the end of the command to pause the display.
Allows you to move a file from one location to another.
e.g MOVE filename c:\windows\desktop
You can also specify a different filename after moving the file.
e.g MOVE filename c:\windows\desktop\anothername
Sorts the content of a text file Alphabetically.
e.g SORT/+3 > file will sort input from the keyboard based on third char.
Allows you to create virtual hard drives. For instance you can set
c:\myfolder as drive D:\ (make sure you don't have any drive D:\)
SUBST D: c:\myfolder
Open My Computer and check Drive D: Even if you exit command prompt the drive remains
To reset the virtual drive type SUBST d: /D
You cannot apply any of the following commands to your virtual hard drive: CHKDSK -
DISKCOPY - FDISK - FORMAT - LABEL - SYS
Which is quite logical since you don't have any real disk it's just an assignment to a
PS: Very curcial file.
Copies MS-DOS system files and Command interpreter to a disk
you specify. SYS locationOfSystemFiles drive
e.g To transfer system files from C to A, type: SYS C: A:
XCopy copies directories and subdirectories unlike Copy which
only copy files. XCopy can also be used as a backup utility.
XCOPY /S folder c:\myfolder\ will copy the content of "folder" including sub-directories to