List of DOS commands
|
A list of DOS commands for Microsoft's MS-DOS operating system follows. In version 6 only, the user could get help by typing HELP in the shell prompt. Square brackets indicate optional parameters, while italicized items should be replaced with specific values.
In the list below, when a command can accept more than one filename, or a filename including wildcards (* and ?), it is said to accept a filespec parameter. Commands that can accept only a single filename are said to accept a filename parameter.
Contents |
Commands
attrib
- Change or view the attributes of one or more files. It defaults to displaying the attributes of all files in the current directory.
Options:
- To add an attribute attach a '+' in front of it.
- To remove an attribute attach a '-' in front of it
- Attributes include
- A - Archived (used mainly by file archiving software)
- H - Hidden
- S - System
- R - Read-only
attrib [+|-ahrs] [filespec]
- Roughly equivalent to the Unix command
chmod
.
cd or chdir
- Change current directory.
cd directory
- Equivalent to the Unix command
cd
.
cls
- Clears the screen, except for the command prompt.
cls
- Equivalent to the Unix command
clear
.
copy
- Copies files from one location to another. The destination defaults to the current directory. If multiple source files are indicated, the destination must be a directory, or an error will result.
copy filespec [destination]
- Equivalent to the Unix command
cp
.
copy con
- Allows the user to type text directly into a file. If the file already exists, will prompt to overwrite.
copy con filename
- The console will then go into a mode which allows the user to type any amount of text, even with line breaks. Press Ctrl+Z to finish and write to the file.
del
- Deletes files.
del vikas
- Equivalent to the Unix command
rm
.
deltree
- Deletes a directory along with all of the files and subdirectories that it contains. Normally, it will ask for confirmation of such a drastic action.
deltree [/y] directory
- No direct Unix equivalent. Use
rm -r
(or-rf
for the/y
switch).
dir
Main article: Dir (DOS Command)
- Displays contents of a directory.
Options :
- /w : Wide list format
- /p : Pause at every page
- /s : Also look in subdirectories
- /a[xx] : Display files with the specified attributes only
- /o[xx] : Modifies sort order
dir [options] [filespec]
- Equivalent to the Unix command
ls
(the option-l
is "long" list format, it works the opposite way from/w
.)
echo
- Prints its own arguments back out to the DOS equivalent of the standard output stream. Usually, this means directly to the screen, but the output of echo can be redirected like any other command. Often used in batch files to print text out to the user.
echo text
- Echo can be used to write to files directly from the console, by redirecting the output stream:
echo text > filename
- To type more than one line from the console into a file, use
copy con
(above). - Equivalent to, but less powerful than, the Unix command
echo
.
format
- Delete all the files on the disk and reformat it for MS-DOS
- In most cases, this should only be used on floppy drives or other removable media. This command can potentially erase everything on a computer's hard disk.
- /autotest is an undocumented feature. Adding it formats the drive without a confirmation prompt.
format [options] drive
Known as a joke among UNIX users of that time since every user on the machine could easily cause damage with just one command. Therefore, it was known in the UNIX community as "The big DOS timesaver".
- No direct Unix equivalent, although
dd
andmkfs
are equally dangerous.
InterLnk
- MS-DOS 6 and above command to network PCs using a null modem cable or LapLink cable. InterLnk is the client-side program (InterSvr is the server) which mapped the drives of the machine running InterSvr to the local machine.
- No Unix equivalent.
InterSvr
- MS-DOS 6 and above command used to network PCs using a null modem cable or LapLink cable. The server-side version of InterLnk, it also immobilizes the machine it's running on as it's an active app (As opposed to a TSR) which must be running for any transfer to take place.
- No Unix equivalent.
label
- Changes the label on a logical drive, such as a hard disk partition or a floppy disk.
label drive
- No Unix equivalent, as Unix does not use drive labels.
md or mkdir
- Makes a new directory. The parent of the directory specified must already exist.
md directory
- Equivalent to the Unix command
mkdir
.
more
- Pages through the output so that you can view more than one screen of text.
command | more
- Equivalent to the Unix command
more
.
move
- Moves a file.
move filename newfilename
- Equivalent to the Unix command
mv
.
pcpark
- Parks the hard disk(s) (stops their turning) in order to enable safe shutdown; only used on early versions.
pcpark
- No Unix equivalent.
rd or rmdir
- Remove a directory, which must be empty of files.
rd directory
- Equivalent to the Unix command
rmdir
.
ren
- Renames a file.
ren filename newname
- No direct Unix equivalent.
mv
does the same job when working within the same volume.
time and date
- Set/display the date and time
date time
- Equivalent to the Unix command
date
.
tree
- Shows the directory tree of the current directory
- Options:
- /F (Displays the names of the files in each folder.)
- /A (Use ASCII instead of the extended characters.)
tree [options] [directory]
- No direct Unix equivalent, but for example
du
can display a directory tree.
type
- Display a file. The more command is frequently used in conjunction with this command, e.g. type long-text-file | more.
type filename
- Equivalent to the Unix command
cat
.
ver
- Shows the version of MS-DOS you are using
- Some versions of MS-DOS support an undocumented /r switch, which will show the revision as well as the version.
ver [/r]
- No Unix equivalent, but
uname -a
displays system information.
xcopy
- Copy entire directory trees.
xcopy directory [destination-directory]
- No direct Unix equivalent. Use
cp -r
.
External links
There are several guides to DOS commands available that are licenced under the GNU Free Documentation License:
- The FreeDOS HTML Help (http://help.fdos.org./en/index.htm) at fdos.org (http://fdos.org./) is a fully hypertext help system for FreeDOS commands, written in 2003/2004
- The FreeDOS Spec (http://fd-doc.sourceforge.net/spec/commands.html) at SourceForge is a plaintext specification, written in 1999, for how DOS commands should work in FreeDOS
Wikibooks also has a guide to Microsoft Windows (as opposed to DOS) commands.
- MS-DOS commands (http://www.computerhope.com/msdos.htm)