|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Displays or changes file attributes. There are four types of DOS attributes: Read only, Archive, System and Hidden. A novice is only ever likely to use the Read only attribute to start with, to stop files from being deleted or changed.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename] [/S] + Sets an attribute. - Clears an attribute. R Read-only file attribute. A Archive file attribute. S System file attribute. H Hidden file attribute. /S Processes files in all directories in the specified path. i.e. Processes files in sub-directories of the current directory.
attrib +r myfile.xyz - Makes myfile.xyz read-only. attrib +h -r *.abc - Makes all files with extension '.abc' hidden, and write-able to.< attrib - Displays attributes of all files in current directory.
Displays the name of the directory you are in or changes the current directory (go to a new directory).
CHDIR [drive:][path] CHDIR[..] CD [drive:][path] CD[..] .. Specifies that you want to change to the parent directory. Type CD drive: to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory.
cd fred - Change into the directory 'fred'. cd \stuff - Change into the directory 'stuff' off the root (top) directory. cd \ - Change back to the root (top) directory. cd .. - Change to the ditrectory above the current directory (also known as the parent directory).
Checks a disk and displays a status report.
CHKDSK [drive:][[path]filename] [/F] [/V] [drive:][path] Specifies the drive and directory to check. filename Specifies the file(s) to check for fragmentation. /F Fixes errors on the disk. /V Displays the full path and name of every file on the disk. Type CHKDSK without parameters to check the current disk.
chkdsk a: - Check the floppy disk in drive A. Informs you of any errors but does not fix them. chkdsk /f a: - Check disk in drive A:, fixing any errors it finds.
NOTE: If you are using DOS 6.2 or later then there is a utility called SCANDISK which is better at detecting and fixing problems than CHKDSK. It is recommended that you use this instead of CHKDSK, although there is, of course, nothing wrong with CHKDSK itself.
Clears the screen. What more can I say?
CLS
Compares the contents of two files or sets of files.
COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] data1 Specifies location and name(s) of first file(s) to compare. data2 Specifies location and name(s) of second files to compare. /D Displays differences in decimal format. This is the default setting. /A Displays differences in ASCII characters. /L Displays line numbers for differences. /N=number Compares only the first specified number of lines in each file. /C Disregards case of ASCII letters when comparing files. To compare sets of files, use wildcards in data1 and data2 parameters.
comp a1.dat a2.dat - Compares the files 'a1.dat' and 'a2.dat'. If they are not identical, any differences will be shown on screen.
Copies one or more files to another location.
COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] [/V] [/Y | /-Y] source Specifies the file or files to be copied. /A Indicates an ASCII text file. /B Indicates a binary file. destination Specifies the directory and/or filename for the new file(s). /V Verifies that new files are written correctly. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. (This is default) The switch /Y may be preset in the COPYCMD environment variable. To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format).
copy myfile.txt a: - Copy myfile.txt to drive a: (floppy drive). copy *.abc fred - Copy all files with extension '.abc' to the fred directory. copy /b a + b c - Copy files 'a' and 'b' to file 'c', combining them together, with 'b' added onto the end of 'a' in 'c'.
Displays or sets the date.
DATE [mm-dd-yy] mm-dd-yy Sets the date you specify. Type DATE without parameters to display the current date setting and a prompt for a new one. Press ENTER to keep the same date. This is the easiest way to set the date.
Deletes one or more files.
DEL [drive:][path]filename [/P] ERASE [drive:][path]filename [/P] [drive:][path]filename Specifies the file(s) to delete. Specify multiple files by using wildcards. /P Prompts for confirmation before deleting each file.
del file.abc - Delete 'file.abc'. del c:\temp\*.* - Delete all files in the directory 'temp' on drive 'c'.
Deletes a directory and all the subdirectories and files in it.
To Delete one or more files and directories: DELTREE [/Y] [drive:]path [[drive:]path[...]] /Y Suppresses prompting to confirm you want to delete the subdirectory. [drive:]path Specifies the name of the directory you want to delete. Note: Use DELTREE cautiously. Every file and subdirectory within the specified directory will be deleted.
deltree fred - Deletes the directory 'fred', and everything in it, including sub-directories.
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/P] [/W] [/A[[:]attribs]] [/O[[:]sortord]] [/S] [/B] [/L] [/C[H]] [drive:][path][filename] Specifies drive, directory, and/or files to list. /P Pauses after each screenful of information. /W Uses wide list format. /A Displays files with specified attributes. attribs D Directories R Read-only files H Hidden files S System files A Files ready to archive - Prefix meaning "not" /O List by files in sorted order. sortord N By name (alphabetic) S By size (smallest first) E By extension (alphabetic) D By date & time (earliest first) G Group directories first - Prefix to reverse order C By compression ratio (smallest first) /S Displays files in specified directory and all subdirectories. /B Uses bare format (no heading information or summary). /L Uses lowercase. /C[H] Displays file compression ratio; /CH uses host allocation unit size. Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with - (hyphen)--for example, /-W.
dir - List all the files, along with their sizes (in bytes) and the date and time they were created, one to a line. dir /w - List just the file names, several to a line. dir /oe - Lists all files in the current directory sorted by extension alphabetically. For example, all '.BAT's will appear before all '.EXE's. dir /on /ad - Lists directories ('/ad') in alphabetical order ('/oe').DISKCOMP
Compares the contents of two floppy disks. Any differences are displayed on screen.
Syntax
DISKCOMP [drive1: [drive2:]] [/1] [/8] /1 Compares the first side of the disks. /8 Compares only the first eight sectors of each track.Example
diskcomp a: a: - Compare two disks in floppy drive A: - It will tell you when to insert disk 1 and when to insert disk 2.DISKCOPY
Copies the contents of one floppy disk to another. This copies an entire disk, not just a group of files.
Syntax
DISKCOPY [drive1: [drive2:]] [/1] [/V] [/M] /1 Copies only the first side of the disk. /V Verifies that the information is copied correctly. /M Force multi-pass copy using memory only. The two floppy disks must be the same type. You can't, for example, copy from 3.5 inch to 5.25 inch, or low to high density on either size. You may specify the same drive for drive1 and drive2.Example
diskcopy a: a: - Copy the contents of a disk (Source disk) to another disk (Target disk). It will tell you when to insert which disk. Make sure that the Target disk is either blank or contains no important data!!!NOTE: Make sure the target disk is either blank, or contains no important data!!! Also, if the target disk is unformatted, DISKCOPY kindly formats the disk for you automatically.
EXIT
Quits the COMMAND.COM program (command interpreter, or DOS prompt).
Syntax
EXITExample
If you have entered the DOS prompt from within Windows, what actually happened was that Windows ran a file called 'COMMAND.COM', which opens a new command interpreter. This is what the DOS prompt is. The command 'EXIT' is used to close down the interpreter - i.e. exit from the DOS prompt and close it down, returning you to Windows.
FASTHELP
NOTE: This command appears in DOS 6.0 and higher only.
Provides help information for MS-DOS commands. This shows a brief page showing any parameter uses and other quick information. See HELP for more detailed help
Syntax
FASTHELP [command] command - displays help information on that command.Example
fasthelp copy - Displays a page of help for the COPY command.NOTE: Typing 'command /?' is the same as typing 'fasthelp command'.
FC
Compares two files or sets of files and displays the differences between them. This is essentially a more complicated version of COMP.
Syntax
FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn] [drive1:][path1]filename1 [drive2:][path2]filename2 FC /B [drive1:][path1]filename1 [drive2:][path2]filename2 /A Displays only first and last lines for each set of differences. /B Performs a binary comparison. /C Disregards the case of letters. /L Compares files as ASCII text. /LBn Sets the maximum consecutive mismatches to the specified number of lines. /N Displays the line numbers on an ASCII comparison. /T Does not expand tabs to spaces. /W Compresses white space (tabs and spaces) for comparison. /nnnn Specifies the number of consecutive lines that must match after a mismatch.FORMAT
Formats a disk for use with MS-DOS.
Syntax
FORMAT drive: [/V[:label]] [/Q] [/U] [/F:size] [/B | /S] [/C] FORMAT drive: [/V[:label]] [/Q] [/U] [/T:tracks /N:sectors] [/B | /S] [/C] FORMAT drive: [/V[:label]] [/Q] [/U] [/1] [/4] [/B | /S] [/C] FORMAT drive: [/Q] [/U] [/1] [/4] [/8] [/B | /S] [/C] /V[:label] Specifies the volume label. /Q Performs a quick format. /U Performs an unconditional format. /F:size Specifies the size of the floppy disk to format (such as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88). /B Allocates space on the formatted disk for system files. /S Copies system files to the formatted disk. /T:tracks Specifies the number of tracks per disk side. /N:sectors Specifies the number of sectors per track. /1 Formats a single side of a floppy disk. /4 Formats a 5.25-inch 360K floppy disk in a high-density drive. /8 Formats eight sectors per track. /C Tests clusters that are currently marked "bad."Examples
The following examples are probably the only ways you are ever likely to need to use FORMAT (although all the parameters are given above).
format a: - Format a disk in floppy drive a: format a: /s - Format a disk in drive a: and make it bootable (by adding system files to it). This means you can start up the computer using this disk instead of the hard disk (like normal). format a: /f:720 - Format a disk in drive a: as a 720k disk (useful when formatting low density 3.5 inch disks in high density drives).HELP
Starts MS-DOS Help on MS-DOS commands. This program gives you more detailed help. See FASTHELP for a more brief page of help.
Syntax
HELP [/B] [/G] [/H] [/NOHI] [topic] /B Allows use of a monochrome monitor with a color graphics card. /G Provides the fastest update of a CGA screen. /H Displays the maximum number of lines possible for your hardware. /NOHI Allows the use of a monitor without high-intensity support. [topic] Specifies the help topic to view.Examples
help - Starts the MS-DOS help program and takes you to an index of all the commands. help copy - Starts the MS-DOS help program and takes you straight to the help page for the copy command.LABEL
Creates, changes, or deletes the volume label of a disk. You can see the volume label when you use DIR. (It says 'Volume in drive X is LABEL', where X is the drive (e.g. C) and LABEL is the volume label). You can have disks without volume labels.
Syntax
LABEL [drive:][label]Examples
label - Label the current drive (either change, create, or delete a volume label). If you create or change a label, you will be prompted for a new one. label a: - Label floppy drive a:MEM
NOTE: This command appears in DOS 5.0 and higher only. Also, MEM in DOS version 5.0 may differ slightly from what's below, which was taken from DOS 6.x.
Displays the amount of used and free memory in your system.
MEM [/CLASSIFY | /DEBUG | /FREE | /MODULE modulename] [/PAGE] /CLASSIFY or /C Classifies programs by memory usage. Lists the size of programs, provides a summary of memory in use, and lists largest memory block available. /DEBUG or /D Displays status of all modules in memory, internal drivers, and other information. /FREE or /F Displays information about the amount of free memory left in both conventional and upper memory. /MODULE or /M Displays a detailed listing of a module's memory use. This option must be followed by the name of a module, optionally separated from /M by a colon. /PAGE or /P Pauses after each screenful of information.Example
mem - Display information about how memory is free / how much in total, etc.MKDIR (or MD)
Creates a directory.
Syntax
MKDIR [drive:]path MD [drive:]pathExamples
mkdir fred - Make the directory 'fred' in the current directory (Can also be called a sub-directory). md \bitsbobs - Make the directory 'bitsbobs' in the root (top level) directory.MOVE
Moves files and renames files and directories.
Syntax
To move one or more files: MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination To rename a directory: MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2 [drive:][path]filename1 Specifies the location and name of the file or files you want to move. destination Specifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also include a filename if you want to rename the file when you move it. [drive:][path]dirname1 Specifies the directory you want to rename. dirname2 Specifies the new name of the directory. /Y Suppresses prompting to confirm creation of a directory or overwriting of the destination. /-Y Causes prompting to confirm creation of a directory or overwriting of the destination. The switch /Y may be present in the COPYCMD environment variable. This may be overridden with /-Y on the command line.Example
move thisfile.txt fred - move the file 'thisfile.txt' into the directory 'fred'. OR: if 'fred' does not exist, it will rename the file from 'thisfile.txt' to 'fred', as if RENAME had been used instead of MOVE.PATH
Displays or sets a search path for executable files. See the glossary for information on what a path is.
Syntax
PATH [[drive:]path[;...]] PATH ; Type PATH ; to clear all search-path settings and direct MS-DOS to search only in the current directory. Type PATH without parameters to display the current path.PROMPT
Changes the MS-DOS command prompt. The prompt appears when DOS is ready to accept a command from you.
Syntax
PROMPT [text] text Specifies a new command prompt. Prompt can be made up of normal characters and the following special codes: $Q = (equal sign) $$ $ (dollar sign) $T Current time $D Current date $P Current drive and path $V MS-DOS version number $N Current drive $G > (greater-than sign) $L < (less-than sign) $B | (pipe) $H Backspace (erases previous character) $E Escape code (ASCII code 27) $_ Carriage return and linefeed Type PROMPT without parameters to reset the prompt to the default setting.Examples
prompt $p$g - Displays the default prompt: 'x:\dir\>', where 'x' is the current drive and 'dir' is the current directory. '$p' produces the 'x:dir\' and '$g' produces the '>'. prompt Hello $n There $q$g - Displays the prompt: 'Hello x There =>', where 'x' is the current drive. '$n' produces the drive letter 'x', '$q' produces the '=' and '$g' produces the '>'.RENAME (or REN)
Renames a file or files.
Syntax
RENAME [drive:][path]filename1 filename2 REN [drive:][path]filename1 filename2 Note that you cannot specify a new drive or path for your destination file. The destination drive or path must exist already You can also use MOVE to rename a directory, or to move files from one directory to another.Example
ren abc.txt def.txt - Renames the file 'abc.txt' to 'def.txt'. Note: 'abc.txt' must exist before- hand, and 'def.txt' must not exist already.RMDIR (or RD)
Removes (deletes) a directory. The directory must be empty first. If it isn't, you should delete everything (i.e. files and subdirectories) in it, or move the contents elsewhere.
Syntax
RMDIR [drive:]path RD [drive:]pathExamples
rmdir fred - delete the directory 'fred'. rmdir \blogg - delete the directory 'blogg' from the root (top) directory.TIME
Displays or sets the time.
Syntax
TIME [time] Type TIME without parameters to display the current time setting and a prompt for a new one. Press ENTER to keep the same time. This is the easiest way to set the date.TREE
Graphically displays the directory structure of a drive or path.
Syntax
TREE [drive:][path] [/F] [/A] /F Displays the names of the files in each directory. /A Uses ASCII instead of extended characters.Examples
tree - Displays a graphical directory structure from the current directory down. tree c:\ - Displays a graphical directory structure of drive c: from the root directory down.TYPE
Displays the contents of a text file.
Syntax
TYPE [drive:][path]filenameExamples
type myfile.txt - prints out 'myfile.txt' to the screen. type fred.mod | more - prints out 'fred.mod', pausing after each screenful. NOTE: more is a filter. It takes the output of everything to the left of the '|', and deals with that, by displaying it a screenful at a time. See the section on filters about this.UNDELETE
Restores files previously deleted with the DEL command. When you delete a file, it doesn't physically disappear from disk. DOS is just told that the area the file occupies is free to be overwritten by a new file. This is done by replacing the first letter of the file name with a question mark.If the deleted file hasn't yet been overwritten, it is possible to recover the file.
Syntax
UNDELETE [[drive:][path]filename] [/DT | /DS | /DOS] UNDELETE [/LIST | /ALL | /PURGE[DRIVE] | /STATUS | /LOAD | /UNLOAD /UNLOAD | /S[DRIVE] | /T[DRIVE]-entrys ]] /LIST Lists the deleted files available to be recovered. /ALL Recovers files without prompting for confirmation. /DOS Recovers files listed as deleted by MS-DOS. /DT Recovers files protected by Delete Tracker. /DS Recovers files protected by Delete Sentry. /LOAD Loads Undelete into memory for delete protection. /UNLOAD Unloads Undelete from memory. /PURGE[drive] Purges all files in the Delete Sentry directory. /STATUS Display the protection method in effect for each drive. /S[drive] Enables Delete Sentry method of protection. /T[drive][-entrys] Enables Delete Tracking method of protection.Example
undelete - looks for files in the current directory that have been deleted. For every file it finds, it asks you if you want to recover it if it can, and if so, what the first letter of the file name is.This is the usual way of using undelete, without any parameters.
UNFORMAT
Restores a disk erased by the FORMAT command. If you accidentally format a disk, it is possible to reverse this, providing FORMAT was able to save the unformat information. FORMAT tells you if it can't do this. If you have saved anything to the disk since the format, then you won't be able to rescue it at all.
Syntax
UNFORMAT drive: [/J] UNFORMAT drive: [/U] [/L] [/TEST] [/P] UNFORMAT /PARTN [/L] drive: Specifies the drive to unformat. /J Verifies that the mirror files agree with the system information on the disk. /U Unformats without using MIRROR files. /L Lists all file and directory names found, or, when used with the /PARTN switch, displays current partition tables. /TEST Displays information but does not write changes to disk. /P Sends output messages to printer connected to LPT1. /PARTN Restores disk partition tables.VER
Displays the MS-DOS version.
Syntax
VERVOL
Displays the disk volume label and serial number, if they exist.
Syntax
VOL [drive:]XCOPY
Copies files (except hidden and system files) and directory trees. This command improves on COPY by reading everything first, then writing them in bulk. This results in fewer disk accesses, speeding things up a bit, particularly on a slow disk or network drive.
Syntax
XCOPY source [destination] [/A | /M] [/D:date] [/P] [/S] [/E] [/V] [/W] source Specifies the file(s) to copy. destination Specifies the location and/or name of new files. /A Copies files with the archive attribute set, doesn't change the attribute. /M Copies files with the archive attribute set, turns off the archive attribute. /D:date Copies files changed on or after the specified date. /P Prompts you before creating each destination file. /S Copies directories and subdirectories except empty ones. /E Copies any subdirectories, even if empty. /V Verifies each new file. /W Prompts you to press a key before copying. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command lineExamples
xcopy a*.doc a:\ - copies all files beginning with a, and with a '.doc' extension to the root directory of floppy drive a. xcopy *.txt texts - copies all files with a '.txt' extension to a directory called 'texts' (assuming this directory exists) xcopy *.* c:\fred /s - copies all files in the current directory and all directories below it to the 'fred' directory on the root (top) of drive c. The The directories are copied with the files.