Some Examples of common DOS commands?

The following is a list of useful DOS commands, withexplanations. They are useful on older DOS systems and in thecommand-line interface on modern Windows systems. To access thecommand-line interface:
  • Windows 7 or Vista: Click Start, typecmd , and then press Enter.Certain commands may require administrative access on Windows 7 orVista. To launch the command line interface in administrative mode,click Start, type cmd , and thenright-click the cmd or cmd.exe search result andchoose Run as Administrator.
  • Windows XP: Click Start, thenRun. Type cmd , and then pressEnter.
Note: Where example files (e.g.,file.ext, file1, file2), fileextensions (.ext), directories (e.g., diry,diry1, diry2), commands (e.g.,command), and drive letters (e.g., a:,b:, c:) are given, substitute the name ofyour own file, directory, command, or drive letter. Since DOS is notcase-sensitive, you can type these commands in either upper- or lowercase.
help List commands (only in DOS versions 5 orlater).
help command See help for the DOScommand.
command /? List switches for the DOScommand.
path=c:windows ; c:dos Specify in which directories DOS searches for commands or programs.
prompt $p$g Make the DOS prompt display thecurrent directory.
dir List files in the current directory in onecolumn.
dir /w List files in five columns.
dir /p List files one page at a time.
dir *.ext List all files with an.ext extension.
dir z???.ext List files with .extextensions that have four letters and start with z  (where  z  is acharacter of your choice).
dir file.ext /s Search for thefile.ext in the current directory and all subdirectoriesunder the current directory; most useful if the current directory isthe root (i.e.,  C: ).
type file.ext View the contents of the text filefile.ext.
edit file.ext Use the DOS editor to edit thefile file.ext.
a: Change to the a: drive.
md c:diry Make a new subdirectory nameddiry in the c: directory.
cd c:diry Change to subdirectorydiry.
rd c:diry Remove the existing subdirectorynamed diry.
del file.ext Delete a file namedfile.ext.
ren file1 file2 Rename file file1to file2.
copy file1 file2 Copy file file1to file2.
verify on Turn on verification of copycommands.
verify off Turn off verification of copycommands.
xcopy diry1 diry2 /s Copy all files andsubdirectories in directory diry1 to diry2.
xcopy diry1 diry2 /p Ask for confirmation ofeach file before copying it from diry1 todiry2.
diskcopy a: b: Duplicate a disk using twofloppy drives.
diskcopy a: a: Duplicate a disk using the samefloppy drive.
format a: Format a disk in drivea: .
format a: /s Format a bootable disk(include system files).
backup c:diry*.ext a: Back up all files withthe extension .ext in c:diry to drivea: .
backup c: a: /s Back up the entirec: de> drive to drive a: .
restore a: c:diry*.ext Restore backed-upfiles with the extension .ext in drive a: tothe c:diry directory.
restore a: c: /s Restore backed-up files andsubdirectories from drive a: to c: .
ver Check the version of DOS.
time Check or correct the system time.
date Check or correct the system date.
cls Clear the screen.
scandisk Scan and check drive c:for errors. ScanDisk replaces chkdsk (seebelow) on DOS version 6.0 and above (including Windows 95).
chkdsk Check disk and memory usageof the current disk.
chkdsk /f Fix errors reported bychkdsk.
chkdsk file.ext Check a particular file.
chkdsk a: Check a particular drive (in thiscase, a floppy in the a: drive).
mem Check memory usage.

Leave a Reply