Guides:Shells/COMMAND.COM-CMD.EXE/DOS Commands

From CoderGuide

Jump to: navigation, search

Return to: Guides:Shells/COMMAND.COM-CMD.EXE

DOS Commands

Commands in DOS and Windows are not case sensitive, unlike Unix. That means "DOS" "DoS" and "dos" are all treated as being the same.

If no DOS version is given, then the command is at least known to work in version 3.0 and later.

Built-in commands

These commands are part of COMMAND.COM/CMD.EXE

Since MS-DOS 5.0, most of these commands will give a help statement if you type /? after the command name. Alternatively, you can try "help (command name)"

VERPrints the operating system version.1.0
COPYcopies one file to another1.0
DEL, ERASEremoved a file or files1.0
CD, CHDIRchange the current directory, or print the current working directory2.0
RD, RMDIRremove a directory2.0
MD, MKDIRcreate a directory2.0
RENAME, REN rename a file (does not rename directories in DOS and earlier Windows versions)
ECHOprints text to the screen. Also will turn off echoing commands executed in a batch file, or will print the echo status.
CLSclear the screen
FORPerform a command on a series of files given in for loop
IFperforms a logical test
GOTOgo to a section in a batch file
EXITexits command shell (does not work for startup shell)
CALLruns a another batch file without stopping current script/command.
PROMPTChanges the command prompt
SETSets an environment variable, or displays currently set environment variables (similar to export command in the Bourne shells).
DIRDisplays the contents of a directory, or the current directory if none is given.
LH, LOADHIGHLoads a program into high memory. Mainly used for TSRs (Terminate and Stay Resident) programs. Works only with high memory manager loaded (himem.sys)5.0
PAUSEPrints a prompt asking the user to press enter. Used to halt a batch file's execution.
REMDoesn't do anything. It's used to add comments to a batch file. BASIC uses the same statement (can be used in CONFIG.SYS, but will produce error messages).
TYPETypes the contents of a file (see MORE below


Command line utilities. Note: Some of these utilities were dropped after later versions of Windows.

XCOPYImproved and faster copy. Also allows copying of subdirectories, which COPY does not do.3.0
MODEChanges the current mode of a device, such as the screen resolution and COM port speed
PRINTprint spooler
DOSKEYNice utility to allow better editing of the command line, and remembers old commands.
FORMATformats a drive (write file system to disk)1.0
CHKDISKChecks the integrity of a FAT file system, and allows for fixing of a corrupt file system. You don't want to use this on a Win 95/98 or above system. Use SCANDISK instead.
SCANDISKPerforms better checking of a FAT (and later NTFS) filesystem.6.x
DEFRAGDefragments a hard drive. Same command is used on the latest version of windows (other disk defragmentors existed before this one, many were faster)DOS 6.x
EDITEdit or create a text document using a nice text editor (part of QBASIC program)5.0
EDLINLine text editor. This is the smallest, simplest, plainest, and arcane text editor DOS ever had. Boy was it fun using :-)Dropped after DOS 5.0
SORTSorts the text given to the proram
FINDFinds text in a file
DEBUGAllows for editing and creating binary files. Also has a debugger and assembler for making changes to programs, or writing your own in assembler.Not Found in WinXP
MOREPauses output so that a human has a chance to read it before it scrolls off the screen.
FDISKPartition hard drive, and repair Master Boot Record (MBR)
Personal tools