PrepLogic.com

 

Batch Files & Batch Commands

(DOS) commands and their usage in batch files

Command Function Available in (3rd Party)
Replacement
DOS Win9x NT OS/2
ACINIUPD Modify INI files (TS only) N N Y N  
ANSI.SYS Text attributes, cursor & keyboard manipulation Y N N Y Download ANSI.COM (DOS only TSR)
APPEND Allows programs to open data files in specified directories as if they were in the current directory (DOS) Y Y Y Y  
ARP Display or modify IP-to-Physical address translation tables used by ARP N Y Y Y  
ASSOC Associate a file extension with a file type, or list all associations N N Y N  
AT Command line scheduler N N Y Y JT, SCHTASKS
ATTRIB List & manipulate file attributes Y Y Y Y  
AUTOFAIL Suppress network connection error messages at startup N N N Y  
BACKUP Backup files to floppy disks (requires RESTORE from the exact same DOS version) Y Y N Y NTBACKUP, Several commercial image backup tools
BASICA Basic interpreter for IBM PC-DOS Y N N N GWBASIC, QBASIC
BOOTCFG Edit Windows boot settings in BOOT.INI (XP) N N Y N  
BREAK Enable/disable extended Ctrl+C checking (16-bits) Y Y Y Y  
CACLS Read and set file access permissions N N Y N SECEDIT, Download SUBINACL, XCACLS
CALL Run a batch file from within another batch file Y Y Y Y  
CD Show or change the current directory (same as CHDIR) Y Y Y Y  
CERTREQ Request certificates from a certification authority (Windows Server 2003) N N Y N  
CERTUTIL Manage certificates (Windows Server 2003) N N Y N  
CHANGE Change TS port mappings, install mode, or enable/disable TS logon N N Y N  
CHCP Display or set the active Code Page Y Y Y Y  
CHDIR Show or change the current directory (same as CD) Y Y Y Y  
CHGLOGON Enable/disable TS logon N N Y N  
CHGPORT Change TS port mappings N N Y N  
CHGUSR Change TS install mode N N Y N  
CHKDSK Check a disk for file system errors or bad sectors Y Y Y Y  
CHKNTFS Display or modify the checking of disk at boot time N N Y N  
CHOICE Prompt user for to choose option from list of choices Y Y N N PMChoice
CIPHER Display or alter the encryption of directories [files] on NTFS partitions N N Y N  
CLEANMGR Automate cleanup of temporary files, IE cache, downloaded files & recycle bin (XP) N N Y N  
CLS Clear the screen/window Y Y Y Y  
CMD.EXE Command interpreter (32-bits) N N Y Y  
COLOR Change text and background color in console N N Y N  
COMMAND.COM Command interpreter (16-bits) Y Y Y Y  
COMP Compare files Y Y Y Y FC, Download my TXTCOMP scripts TxtComp, WINDIFF (GUI)
COMPACT Display or modify file compression on NTFS partitions N N Y N  
%COMSPEC% Command interpreter specification in master environment Y Y Y Y  
CONTROL Start Control Panel or a Control Panel applet N Y Y Y RUNDLL32 SHELL32.DLL,Control_RunDLL
CONVERT Convert a FAT volume to NTFS N N Y N  
COPY Copy files Y Y Y Y ROBOCOPY, XCOPY
CPROFILE Clean profiles of wasted space (Windows Server 2003) N N Y N  
CSCRIPT Console mode interpreter for VBScript/JScript N Y Y N  
CSVDE Import/export data from Active Directory in CSV format N N Y N  
CTTY Redirect all input and output to a file or (serial, parallel or null) device Y N N N  
DATE Display & manipulate system date Y Y Y Y  
DEBUG Debugger & assembler Y Y Y Y  
DEFRAG Locate and consolidate fragmented boot files, data files, and folders on local volumes Y Y Y N  
DEL Delete one or more files Y Y Y Y  
DELTREE Delete an entire folder including files and subfolders Y Y N N RD /S
DEVCON Command line Device Manager (free Microsoft download) N N Y N  
DIANTZ Compress and add files to new or existing .CAB files (equivalent of MAKECAB) N N Y N MAKECAB
DIR List files & directories Y Y Y Y  
DISKCOMP Compare two floppy disks on a track by track basis Y Y Y Y  
DISKCOPY Copy a floppy disks on a track by track basis Y Y Y Y  
DOSKEY Edit or recall command lines, or create command line macros Y Y Y Y  
DISKPART Manipulate harddisk partitions and logical drives N N Y N Acronis Disk Director
DRIVERQUERY List installed drivers (Windows XP) N N Y N  
DSADD Add objects to (active) directory N N Y N  
DSGET Display (active) directory object properties N N Y N  
DSMOD Modify objects in (active) directory N N Y N  
DSMOVE Move or rename objects in (active) directory N N Y N  
DSQUERY Query (active) directory N N Y N  
DSRM Remove object from (active) directory N N Y N  
ECHO Display text on screen Y Y Y Y  
EDIT Text editor in MS-DOS 5+ (requires QBASIC) Y N N N EDLIN
EDLIN Line editor in MS-DOS 4- Y N N N EDIT, COPY CON, many programmers' editors
ENDLOCAL Terminate local environment N N Y Y  
EPAL Elevated Priviliges Application Launcher (free Microsoft download) N N Y N RUNAS, Download CPAU, Download PSEXEC, Download RunAs Pro
ERASE Delete one or more files Y Y Y Y  
EXIT Terminate a batch file or command prompt Y Y Y Y  
EXPAND Expand compressed files or folders on NTFS volumes N N Y Y  
EXTRACT Extract compressed files N Y Y N Download 7-ZIP 7-Zip, Download WinRAR WinRAR
EXE2BIN Convert .EXE files to binary format (DOS) Y Y Y Y  
FASTOPEN Open DOS programs faster by memorizing their locations on disk (DOS) Y Y Y Y  
FC Compare files Y Y Y Y COMP, Download my TXTCOMP scripts TxtComp, WINDIFF (GUI)
FDISK Manipulate harddisk partitions and logical drives Y Y N Y DISKPART, Acronis Disk Director
FIND Search files or standard output Y Y Y Y  
FINDRAMD Find the RAM drive letter N Y N N  
FINDSTR Search files or standard output with advanced options N N Y Y Download EGREP
FOR Loop through a set of files or variables Y Y Y Y  
FORCEDOS Force XP to start the specified program in the MS-DOS subsystem N N Y N  
FORMAT Format disks (intialize file system) Y Y Y Y  
FSUTIL Manage FAT and NTFS file systems (XP) N N Y N  
FTP File Transfer Protocol client N N Y Y TFTP, Fileaze
FTYPE Display or define the "Open" command for a file type N N Y N  
GETMAC Display MAC address for local or remote network adapters (XP and later) N N Y N Download my GETMAC and MACADDR scripts MacAddr
GETTYPE Queries the OS type, version or SP and returns it as an errorlevel (Resource Kit tool) N N Y N Download my GETMAC and MACADDR scripts MacAddr
GOTO Jump to a label or subroutine Y Y Y Y  
GRAFTABL Enable display of extended character set in graphics mode Y Y Y Y  
GWBASIC Basic interpreter for MS-DOS up to version 4 Y N N N BASICA, QBASIC
HELP Display help text for a command Y Y Y Y  
IEXPRESS (Installation) script packager (XP) N N Y N  
IF Test statement Y Y Y Y  
IFCONFIG Configure network adapters N N N Y  
INUSE Replace locked files on the next reboot (Resource Kit tool) N N Y N  
IPCONFIG Configure network adapters N Y Y N  
JT Command line scheduler for Windows 2000 and later (Resource Kit utility) N N Y N AT, SCHTASKS, Download Fileaze trial Fileaze
LABEL Show or set a disk's volume label Y Y Y Y  
LFNFOR Tells the FOR command to use either "8.3" or long file names N Y N N  
LH Load TSRs in high memory (same as LOADHIGH) Y Y N N  
LOADHIGH Load TSRs in high memory (same as LH) Y Y N N  
LOCK Grant 16-bits DOS programs direct access to a disk N Y N N  
LOGOFF Logoff/terminate Windows TS sessions or (local) OS/2 N N Y Y  
MAKECAB Compress and add files to new or existing .CAB files (equivalent of DIANTZ) N N Y N DIANTZ
MD Create a new (sub)directory (same as MKDIR) Y Y Y Y  
MEM Check memory usage (MS-DOS and 16-bits sessions only) Y Y Y Y  
MKDIR Create a new (sub)directory (same as MD) Y Y Y Y  
MODE Configures system devices Y Y Y Y  
MORE Configures system devices Y Y Y Y  
MOUNTVOL Create, delete or list volume mount points (XP) N N Y N  
MOVE Move or rename files or folders Y Y Y Y  
MSD Query for basic system configuration information (MS-DOS 6 & 7) Y Y N N several (commercial) system inventory tools
MSG Send a popup message to TS users/sessions N N Y N  
MSIEXEC Install, modify, and perform operations on Windows Installer from the command line N Y Y N  
MSINFO32 Query for basic system configuration information (Windows 2000+) N N Y N SYSTEMINFO, WINMSD, several (commercial) system inventory tools
NBTSTAT Display protocol statistics and current TCP/IP connections using NBT N N Y N  
NET Command line NetBIOS tool N Y Y Y  
NETDOM Manage domains and trust relationships (join computers to a domain, rename computers, and more) N N Y N  
NETSH Command line network configuration tool for Windows XP and later N N Y N  
NOTEPAD Text editor (GUI editing, command line & GUI printing) N Y Y N Many programmers' editors
NSLOOKUP Diagnose DNS infrastructure N N Y N (PING -a for finding host names)
NTBACKUP Backup files to any Windows supported media N N Y N Several commercial image backup tools
OPENFILES List or disconnect open files and folders N N Y N  
PATH Display or change the program search path Y Y Y Y  
PATHPING Extended PING utility N N Y N TRACERT
PAUSE Wait until a key is pressed Y Y Y Y  
PENTNT Detects floating point division error (if present) in the Pentium chip, disables floating point hardware, and turns on floating point emulation N N Y N  
PING Check the TCP/IP connection to a remote IP address N Y Y Y  
PING6 IPv6 version of PING N N Y N  
POPD Move back to the last directory that was "pushed" on the stack by PUSHD N N Y Y  
POWERCFG Configure power management (Windows Server 2003) N N Y Y  
PRINT Print a text file Y Y Y Y  
PROMPT Configure the DOS prompt string Y Y Y Y  
PUSHD Move to a new directory, "pushing" the current directory on the stack N N Y Y  
QAPPSRV Query available TS application servers N N Y N  
QBASIC Basic interpreter for MS-DOS 5+ Y N N N BASICA, GWBASIC
QCHAIN Install multiple hotfixes with only a single reboot N N Y N  
QFARM Query local TS farm N N Y N  
QPROCESS Query TS servers for running processes N N Y N  
QSERVER Query available ICA-enabled TS servers N N Y N  
QUERY Query TS resources N N Y N  
QUSER Query logged on TS users N N Y N  
QWINSTA Query TS sessions N N Y N  
RASDIAL Use existing RAS/DUN connections N N Y N  
RASPHONE Manage RAS/DUN connections N N Y N  
RD Remove a (sub)directory (same as RMDIR) Y Y Y Y  
READLINE Read a single line from standard output N N N Y  
RECOVER Recover readable information from a bad or defective disk (may sometimes destroy other files in the process) Y Y Y Y Download STRINGS, Several commercial undelete & file recovery tools
REG Read and write the registry (W2K and later) N N Y N  
REGEDIT Read and write the registry (GUI as well as command line) N Y Y Y  
REGEDT32 Read and write the registry (includes setting access permissions) N N Y N REG, REGEDIT, SECEDIT
REGSVR32 Register .DLL & .OCX files as command components in the registry N N Y N  
REM Insert comment line Y Y Y Y  
REN Rename a file or folder (same as RENAME) Y Y Y Y Download Bulk Rename Command, Download Bulk Rename (GUI), Download Renamer (GUI)
RENAME Rename a file or folder (same as REN) Y Y Y Y
REPLACE Copy only files that already exist in the target directory, or copy only files that don't exist yet Y Y Y Y XCOPY /U
RESET SESSION Reset TS session subsystem defaults N N Y N  
RESTORE Restore files backed up with BACKUP (from the exact same DOS version) Y Y N Y NTBACKUP, Several commercial image backup tools
RMDIR Remove a (sub)directory (same as RD) Y Y Y Y  
ROBOCOPY Copy directories, optionally including subdirectory trees and/or permissions, and optionally deleting removed files in the target directory (Resource Kit utility) N N Y N  
ROUTE Display and modify the entries in the local IP routing table N N Y Y  
RUNAS Run a command with different credentials (will always prompt for a password; use CPAU if you need to make this unattended) N N Y N Download CPAU, EPAL, Download PSEXEC, Download RunAs Pro
RUNDLL Command line wrapper for 16-bit DLL routines N Y Y Y  
RUNDLL32 Command line wrapper for 32-bit DLL routines N Y Y N  
SC Command line services managment (XP) N N Y N SERVICES.MSC (GUI)
SCHTASKS Command line task scheduler (XP) N N Y N AT, JT
SECEDIT Configure and analyze system security by comparing your current configuration to a template (Windows 2000+) N N Y N CACLS, Download SUBINACL, XCACLS
SET Manipulate environment variables Y Y Y Y  
SETLOCAL Start local environment N N Y Y  
SHADOW Monitor or take over a TS session N N Y N  
SHELL Primary command interpreter specification in CONFIG.SYS Y Y N Y  
SHIFT Parse command line variables in batch files Y Y Y Y  
SHUTDOWN Shutdown a computer (Resource Kit utility for NT 4 and 2000, native in XP and later) N N Y N TSSHUTDN, Download PSSHUTDOWN
SORT Read a file or standard input and return it sorted alphabetically Y Y Y Y  
START Run a command in a separate process, or run a file with its default associated application N Y Y Y  
SUBINACL Display/modify ACEs for file and folder permissions, ownership and domain (Resource Kit utility) N N Y N CACLS, SECEDIT, XCACLS
SUBST Associate or disassociate a drive alias with a path Y Y Y Y  
SYSTEMINFO Query for basic system configuration information N N Y N WINMSD, several (commercial) system inventory tools
TASKKILL Kill an active process (XP) N N Y N Download PSKILL
TASKLIST List active processes (XP) N N Y N Download PSLIST
TIME Display & manipulate system time Y Y Y Y  
TITLE Set the window title for the command prompt window N N Y N  
TRACERT Analyze the response times on the route to a remote IP address N Y Y N  
TRACERT6 IPv6 version of TRACERT N N Y N  
TRACERTE Analyze the response times on the route to a remote IP address (OS/2) N N N Y  
TREE "Graphically" display the folder structure of a drive or path Y Y Y Y  
TRUENAME Display the real fully qualified path Y Y Y Y  
TSCON Attach a TS user session to a terminal session N N Y N  
TSDISCON Disconnect a TS terminal session N N Y N  
TSKILL Terminate a process in a TS session N N Y N Download PSKILL
TSPROF Copy/update TS user configuration information N N Y N  
TSSHUTDN Shut down or reboot a TS server N N Y N Download PSSHUTDOWN
TYPE Display text file content in console Y Y Y Y  
TZCHANGE Configure/edit time zones N N Y N  
UNLOCK Revoke 16-bits direct disk access granted by the LOCK command N Y N N  
VER Display the OS version Y Y Y Y  
VERIFY Enable/disable verification of disk write operations Y Y Y Y  
VHDMOUNT Mount and access VHD files as virtual disk drives (part of Virtual Server 2005 R2 SP1) N N Y N  
VOL Display a disk's volume label Y Y Y Y  
WINMSD Query for basic system configuration information (for Windows NT 4; in Windows 2000 WINMSD was replaced by MSINFO32) N N Y N MSINFO32, SYSTEMINFO, several (commercial) system inventory tools
WINMSDP Command line helper tool for WINMSD N N Y N
WMIC Query & manipulate objects in WMI (XP Pro and later) N N Y N  
WSCRIPT GUI mode interpreter for VBScript/JScript N Y Y N  
WUPDMGR Start Windows Update in Internet Explorer N Y Y N  
XCACLS Read and set file access permissions (improved CACLS from the Resource Kits) Y Y Y Y CACLS, SECEDIT, Download SUBINACL
XCOPY Copy files & directories with advanced options Y Y Y Y ROBOCOPY, Download XXCOPY

 

Notes: (1) This list is by no means complete.
Only a selection of all commands that can be run in unattended mode from the command line is listed. For a complete list, download and run my AllHelp.bat to create your own custom version of allhelp.html.
  (2) Not all commands are available in all OS versions: CHOICE for example, is available in MS-DOS versions 6.* and 7.* (Windows 95/98) only, TSSHUTDN and other TS commands are available only on Terminal Servers and TS client PCs, DSADD and other AD commands are available only on Active Directory servers and client PCs with the Windows 2000/2003 administrator tools (ADMINPAK.MSI) installed, etc.
  (3) For an up-to-date listing of commands available in the latest Windows versions, see Microsoft's Command-line reference A-Z.