Monday, February 28, 2011

DOS Commands

Arp

The arp command is used to display or change entries in the ARP cache.

Assoc

The assoc command is used to display or change the file type associated with a particular file extension.

At

The at command is used to schedule commands and other programs to run at a specific date and time.

Atmadm

The atmadm command is used to display information related to asynchronous transfer mode (ATM) connections on the system.

Attrib

The attrib command is used to change the attributes of a single file or a directory.

Bootcfg

The bootcfg command is used to build, modify, or view the contents of the boot.ini file, a hidden file that is used to identify in what folder, on which partition, and on which hard drive Windows is located.

Break

The break command sets or clears extended CTRL+C checking on DOS systems.

Cacls

The cacls command is used to display or change access control lists of files.

Call

The call command is used to to run a script or batch program from within another script or batch program.

Chdir

The chdir command is used to display the drive letter and folder that you are currently in. Chdir can also be used to change the drive and/or directory that you want to work in.

Chkdsk

The chkdsk command, often referred to as check disk, is used to identify and correct certain hard drive errors.

Chkntfs

The chkntfs command is used to configure or display the checking of the disk drive during the Windows boot process.

Cipher

The cipher command shows or changes the encryption status of files and folders on NTFS partitions.

Cls

The cls command clears the screen of all previously entered commands and other text.

Cmd

The cmd command starts a new instance of the command interpreter.

Cmstp

The cmstp command installs or uninstalls a Connection Manager service profile.

Color

The color command is used to change the colors of the text and background within the Command Prompt window.

Comp

The comp command is used to compare the contents of two files or sets of files.

Convert

The convert command is used to convert FAT or FAT32 formatted volumes to the NTFS format.

Copy

The copy command does simply that - it copies one or more files from one location to another.

Date

The date command is used to show or change the current date.

Debug

The debug command starts Debug, a command line application used to test and edit programs.

Defrag

The defrag command is used to defragment a drive you specify. The defrag command is the command line version of Microsoft's Disk Defragmenter.

Del

The del command is used to delete one or more files. The del command is the same as the erase command.

Dir

The dir command is used to display a list of files and folders contained inside the folder that you are currently working in. The dir command also displays other important information like the hard drive's serial number, the total number of files listed, their combined size, the total amount of free space left on the drive, and more.

Diskcomp

The diskcomp command is used to compare the contents of two floppy disks.

Diskcopy

The diskcopy command is used to copy the entire contents of one floppy disk to another.

Doskey

The doskey command is used to edit command lines, create macros, and recall previously entered commands.

Driverquery

The driverquery command is used to show a list of all installed drivers.

Echo

The echo command is used to show messages, most commonly from within script or batch files. The echo command can also be used to turn the echoing feature on or off.

Edit

The edit command starts the MS-DOS Editor tool which is used to create and modify text files.

Edlin

The edlin command starts the Edlin tool which is used to create and modify text files from the command line.

Endlocal

The endlocal command is used to end the localization of environment changes inside a batch or script file.

Erase

The erase command is used to delete one or more files. The erase command is the same as the del command.

Eventcreate

The eventcreate command is used to create a custom event in an event log.

Eventquery

The eventquery command is used to display the events and event properties from one or more event logs.

Exe2Bin

The exe2bin command is used to convert a file of the EXE file type (executable file) to a binary file.

Exit

The exit command is used to end the Command Prompt session that you're currently working in.

Expand

The expand command is used to extract a single file or a group of files from a compressed file.

Fastopen

The fastopen command is used to add a program's hard drive location to a special list stored in memory, potentially improving the program's launch time by removing the need for MS-DOS to locate the application on the drive.

Fc

The fc command is used to compare two individual or sets of files and then show the differences between them.

Find

The find command is used to search for a specified text string in one or more files.

Findstr

The findstr command is used to find text string patterns in one or more files.

Finger

The finger command is used to return information about one or more users on a remote computer that's running the Finger service.

For

The for command is used to run a specified command for each file in a set of files. The for command is most often used within a batch or script file.

Format

The format command is used to format a drive in the file system that you specify.

Fsutil

The fsutil command is used to perform various FAT and NTFS file system tasks like managing reparse points and sparse files, dismounting a volume, and extending a volume.

Ftp

The ftp command can used to transfer files to and from another computer. The remote computer must be operating as an FTP server.

Ftype

The ftype command is used to define a default program to open a specified file type.

Getmac

The getmac command is used to display the media access control (MAC) address of all the network controllers on a system.

Goto

The goto command is used in a batch or script file to direct the command process to a labeled line in the script.

Gpresult

The gpresult command is used to display Group Policy settings.

Gpupdate

The gpupdate command is used to update Group Policy settings.

Graftabl

The graftabl command is used to enable the ability of Windows to display an extended character set in graphics mode.

Help

The help command provides more detailed information on any of the other Command Prompt commands.

Hostname

The hostname command displays the name of the current host.

If

The if command is used to perform conditional functions in a batch file.

Ipconfig

The ipconfig command is used to display detailed IP information for each network adapter utilizing TCP/IP. The ipconfig command can also be used to release and renew IP addresses on systems configured to receive them via a DHCP server.

Ipxroute

The ipxroute command is used to display and change information about IPX routing tables.

Label

The label command is used to manage the volume label of a disk.

Loadfix

The loadfix command is used to load the specified program in the first 64K of memory and then runs the program.

Lodctr

The lodctr command is used to update registry values related to performance counters.

Logman

The logman command is used to create and manage Event Trace Session and Performance logs. The logman command also supports many functions of Performance Monitor.

Lpq

The lpq command displays the status of a print queue on a computer running Line Printer Daemon (LPD).

Lpr

The lpr command is used to send a file to a computer running Line Printer Daemon (LPD).

Mem

The mem command shows information about used and free memory areas and programs that are currently loaded into memory in the MS-DOS subsystem.

Mkdir (Md)

The mkdir command is used to create a new folder.

Mmc

The mmc command can be used to open Microsoft Management Console in author mode or to a specific snap-in console, all from the Command Prompt.

Mode

The mode command is used to configure system devices, most often COM and LPT ports.

More

The more command is used to display the information contained in a text file. The more command can also be used to paginate the results of any other Command Prompt command.

Mountvol

The mountvol command is used to display, create, or remove volume mount points.

Move

The move command is used to move one or files from one folder to another. The move command is also used to rename directories.

Msiexec

The msiexec command is used to start Windows Installer, a tool used to install and configure software.

Mstsc

The mstsc command starts the Remote Desktop Connection tool from the Command Prompt.

Nbtstat

The nbtstat command is used to show TCP/IP information and other statistical information about a remote computer.

Net

The net command is used to display, configure, and correct a wide variety of network settings.

Continue: Netstat through Xcopy

There are so many Command Prompt commands that my website can't handle them all in this one list.


Click the link above to see the second half of the Command Prompt commands available in Windows XP.

Did I Miss a Command Prompt Command?

I tried very hard to include every single command available within the Command Prompt in Windows XP in my list above but I certainly could have missed one. If I did, please let me know so I can add it.

Using environment variables with Cmd.exe

The Cmd.exe command-shell environment is defined by variables that determine the behavior of the command shell and the operating system. You can define the behavior of the command-shell environment or the entire operating system environment by using two types of environment variables, system and local. System environment variables define the behavior of the global operating system environment. Local environment variables define the behavior of the environment of the current instance of Cmd.exe.

System environment variables are preset in the operating system and available to all Windows XP processes. Only users with administrative privileges can change system variables. These variables are most commonly used in logon scripts.

Local environment variables are only available when the user for whom they were created is logged on to the computer. Local variables set in the HKEY_CURRENT_USER hive are valid only for the current user, but define the behavior of the global operating system environment.

The following list describes the various types of variables in descending order of precedence:

1.

Built-in system variables

2.

System variables found in the HKEY_LOCAL_MACHINE hive

3.

Local variables found in the HKEY_CURRENT_USER hive

4.

All environment variables and paths set in the Autoexec.bat file

5.

All environment variables and paths set in a logon script (if present)

6.

Variables used interactively in a script or batch file

In the command shell, each instance of Cmd.exe inherits the environment of its parent application. Therefore, you can change the variables in the new Cmd.exe environment without affecting the environment of the parent application.

The following table lists the system and local environment variables for Windows XP.

Variable

Type

Description

%ALLUSERSPROFILE%

Local

Returns the location of the All Users Profile.

%APPDATA%

Local

Returns the location where applications store data by default.

%CD%

Local

Returns the current directory string.

%CMDCMDLINE%

Local

Returns the exact command line used to start the current Cmd.exe.

%CMDEXTVERSION%

System

Returns the version number of the current Command Processor Extensions.

%COMPUTERNAME%

System

Returns the name of the computer.

%COMSPEC%

System

Returns the exact path to the command shell executable.

%DATE%

System

Returns the current date. Uses the same format as the date /t command. Generated by Cmd.exe. For more information about the date command, see Date

%ERRORLEVEL%

System

Returns the error code of the most recently used command. A non zero value usually indicates an error.

%HOMEDRIVE%

System

Returns which local workstation drive letter is connected to the user's home directory. Set based on the value of the home directory. The user's home directory is specified in Local Users and Groups.

%HOMEPATH%

System

Returns the full path of the user's home directory. Set based on the value of the home directory. The user's home directory is specified in Local Users and Groups.

%HOMESHARE%

System

Returns the network path to the user's shared home directory. Set based on the value of the home directory. The user's home directory is specified in Local Users and Groups.

%LOGONSEVER%

Local

Returns the name of the domain controller that validated the current logon session.

%NUMBER_OF_PROCESSORS%

System

Specifies the number of processors installed on the computer.

%OS%

System

Returns the operating system name. Windows 2000 displays the operating system as Windows_NT.

%PATH%

System

Specifies the search path for executable files.

%PATHEXT%

System

Returns a list of the file extensions that the operating system considers to be executable.

%PROCESSOR_ARCHITECTURE%

System

Returns the chip architecture of the processor. Values: x86, IA64.

%PROCESSOR_IDENTIFIER%

System

Returns a description of the processor.

%PROCESSOR_LEVEL%

System

Returns the model number of the processor installed on the computer.

%PROCESSOR_REVISION%

System

Returns the revision number of the processor.

%PROMPT%

Local

Returns the command prompt settings for the current interpreter. Generated by Cmd.exe.

%RANDOM%

System

Returns a random decimal number between 0 and 32767. Generated by Cmd.exe.

%SYSTEMDRIVE%

System

Returns the drive containing the Windows XP root directory (that is, the system root).

%SYSTEMROOT%

System

Returns the location of the Windows XP root directory.

%TEMP% and %TMP%

System and User

Returns the default temporary directories that are used by applications available to users who are currently logged on. Some applications require TEMP and others require TMP.

%TIME%

System

Returns the current time. Uses the same format as the time /t command. Generated by Cmd.exe. For more information about the time command, see Time

%USERDOMAIN%

Local

Returns the name of the domain that contains the user's account.

%USERNAME%

Local

Returns the name of the user who is currently logged on.

%USERPROFILE%

Local

Returns the location of the profile for the current user.

%WINDIR%

System

Returns the location of the operating system directory.