An introduction to batch commands

Batch files are files processed in batches, allowing Windows users to automate system and program processes. To this end, these files receive commands, also called batch commands, which are run through the command line or by prompt. There are hundreds of batch commands, which can automate everything from printer queues to complex tasks.

What batch commands are there?

Hundreds of batch file commands exist, however not all of them work on every operating system. Some batch commands are outdated or only work on operating systems that are hardly used or not used at all nowadays. The following list of batch commands introduces the most important commands that work on the most modern computers and systems, and also provides an insight into the world of possibilities with batch file commands.

Tip

You can find detailed information about how to create and execute your own batch files in our separate article on this topic.

Batch command

Result

Versions of Windows

assoc

Shows or changes the file extension (e.g. .txt or .jpg)

XP

Vista

7, 8, 10

at

Starts a command or program at a specific time; then entered into “Planned tasks”

XP

Vista

7

attrib

Displays or changes file attributes (e.g. file size, modification date, storage location)

XP

Vista

7, 8, 10

cacls

Displays or changes ACLs (access permissions) for files

XP

Vista

7, 8, 10

call

Retrieves a batch file inside another

XP

Vista

7, 8, 10

cd

Switches to another directory or another folder

XP

Vista

7, 8, 10

chcp

Displays or changes the current code page, character table or character map

XP

Vista

7, 8, 10

chdir

Changes the directory or the display of its name

XP

Vista

7, 8, 10

chkdsk

Checks the data carrier for errors

XP

Vista

7, 8, 10

chkntfs

Displays or changes the data carrier check at system start-up

XP

Vista

7, 8, 10

choice

Makes yes/no queries or A/B/C/D selection dialogs possible, including return value

 

 

7, 8, 10

cipher

Makes it possible to encode directories (in NTFS-type partitions) or to display the underlying encoding

XP

Vista

7, 8, 10

cls

Deletes all screen content

XP

Vista

7, 8, 10

cmd

Starts the prompt

XP

Vista

7, 8, 10

cmstp

Makes it possible to install profiles in the connection manager

XP

Vista

7, 8, 10

color

Changes the background color of the current panel

XP

Vista

7, 8, 10

comp

Compares the contents of two or more files

XP

Vista

7, 8, 10

compact

Displays or changes the compression of files in NTFS-type partitions

XP

Vista

7, 8, 10

convert

Converts FAT drives to NTFS

XP

Vista

7, 8, 10

copy

Makes it possible to copy files

XP

Vista

7, 8, 10

cscript

Starts the interpreter for VBScript/JScript

XP

Vista

7, 8, 10

date

Displays and adapts the system date/time

XP

Vista

7, 8, 10

defrag

Makes it possible to defragment drives

XP

Vista

7, 8, 10

del

Deletes individual files

XP

Vista

7, 8, 10

dir

Displays all content of the directory

XP

Vista

7, 8, 10

diskcomp

Compares the content of two different disks

XP

Vista

7, 8, 10

diskpart

Makes it possible to administer data carriers directly within the panel

XP

Vista

7, 8, 10

dism

With DISM, features and packages of Windows images can be listed, installed, uninstalled, configured or updated.

 

 

7, 8, 10

doskey

Creates macros, recalls commands entered previously, and edits the command input

XP

Vista

7, 8, 10

driverquery

Displays the driver for devices installed on the computer

XP

Vista

7, 8, 10

echo

Displays notifications inside the panel, as well as turning the command display on and off

XP

Vista

7, 8, 10

endlocal

Ends a session that was started with setlocal

XP

Vista

7, 8, 10

erase

Deletes one or more files

XP

Vista

7, 8, 10

errorlevel

Displays whether a command was successful or not (0 means yes, 1 means no)

XP

Vista

7, 8, 10

eventcreate

Enters into the event log

XP

Vista

7, 8, 10

eventquery

Lists events or their properties. This is run with the help of cscript

XP

 

 

eventtriggers

Displays or configures event triggers in the event log

XP

 

 

exist

Checks whether a file exists

XP

Vista

7, 8, 10

exit

Closes a batch file or the prompt

XP

Vista

7, 8, 10

expand

Unpacks compressed files or folders

XP

Vista

7, 8, 10

fc

Compares different data and displays the differences

XP

Vista

7, 8, 10

find

Searches for one or several files by entering characters

XP

Vista

7, 8, 10

findstr

Searches for strings within a file, e.g. in the file name or a text

XP

Vista

7, 8, 10

for

Creates a for() loop that retrieves commands as often as specified inside the brackets

XP

Vista

7, 8, 10

format

Makes it possible to format a data carrier

XP

Vista

7, 8, 10

fsutil

Displays and configures the properties of a file system

XP

Vista

7, 8, 10

ftp

Makes it possible to upload and download files via FTP (File Transfer Protocol), e.g. onto a server

XP

Vista

7, 8, 10

ftype

Displays file types and what their assignment is

XP

Vista

7, 8, 10

getmac

Displays the MAC addresses (identifier of a device) for network adapters (local or remote)

XP

Vista

7, 8, 10

goto

Makes it possible to jump to a specific point within a batch file

XP

Vista

7, 8, 10

gpresult

Displays group guidelines that are used on the computer or for a specific user

XP

Vista

7, 8, 10

gpupdate

Makes it possible to update group guidelines

XP

Vista

7, 8, 10

graftabl

Displays special characters in the graphics mode

XP

Vista

7, 8, 10

help

Displays all cmd commands inside the panel

XP

Vista

7, 8, 10

hostname

Displays the computer name

XP

Vista

7, 8, 10

icacls

Makes it possible to display, change, secure or retrieve ACLs and the access control for files and directories

 

 

7, 8, 10

if

Makes it possible to integrate conditions inside batch files, similarly to with JavaScript, for example

XP

Vista

7, 8, 10

ipconfig

Configures IP network settings

XP

Vista

7, 8, 10

irftp

Sends a file on an infrared interface

XP

Vista

7, 8, 10

label

Changes the designation of a data carrier

XP

Vista

7, 8, 10

logman

Administers the service “Performance logs and alerts”

XP

Vista

7, 8, 10

lpr

Makes it possible to send a print job to a printer in the network

XP

 

 

mkdir

Creates a directory

XP

Vista

7, 8, 10

mmc

Retrieves the management panel

XP

Vista

7, 8, 10

mode

Configures system interfaces and devices

XP

Vista

7, 8, 10

more

Displays data page-by-page on the screen

XP

Vista

7, 8, 10

mountvol

Creates, deletes or lists a mount point for a data carrier

XP

Vista

7, 8, 10

move

Renames or moves files or directories

XP

Vista

7, 8, 10

openfiles

Makes it possible to display or separate files or directories that have been opened

 

 

7, 8, 10

msiexec

Installs .msi packages (MSI files are also called Windows Installer package files)

XP

Vista

7, 8, 10

net

Administers and displays network services

XP

Vista

7, 8, 10

netsh

Manage and configure components of the network using the prompt

XP

Vista

7, 8, 10

netstat

Display TCP-IP connections and their status

XP

Vista

7, 8, 10

nslookup

Queries the DNS server

XP

 

 

ntbackup

Starts NTBackup via CommandLine / starts Silent

XP

 

 

path

Displays or establishes the search path for the program selected

XP

Vista

7, 8, 10

pathping

Tests the connection to a selected IP address

XP

Vista

7, 8, 10

pause

The batch file currently being run is stopped and the panel provides the message “Press any key”

XP

Vista

7, 8, 10

perfmon

Starts the performance monitor for Windows

XP

Vista

7, 8, 10

ping

The connection to another device is tested with this

XP

Vista

7, 8, 10

print

Prints out a text-based file

XP

Vista

7, 8, 10

prncnfg

After starting cscript, configuration information for a printer can be displayed or changed

XP

 

 

prndrvr

After starting cscript, printer drivers can be displayed, added or deleted

XP

 

 

prnjobs

After starting cscript, print jobs in the queue can be displayed, stopped or repeated

XP

 

 

prnmngr

After starting cscript, printers or printer connections can be added or a standard printer can be defined

XP

 

 

prnport

After starting cscript, printer ports can be created, deleted or listed.

XP

 

 

prompt

Changes the prompt (e.g. “Good morning!” instead of “Press any key”)

XP

Vista

7, 8, 10

rd

Deletes a directory

 

 

8, 10

recover

Makes it possible to retrieve readable files from a damaged data carrier

XP

Vista

7, 8, 10

reg

Entries in the registry can be added, read, imported or exported

XP

Vista

7, 8, 10

regsvr32

.dll and .ocx files and program libraries can be registered in the registry

XP

Vista

7, 8, 10

rem

All commands after rem are treated as comments by the panel

XP

Vista

7, 8, 10

rename

Files can be renamed with this command

XP

Vista

7, 8, 10

replace

Files can be replaced or overwritten with this command

XP

Vista

7, 8, 10

reset session

Sessions can be separated with the help of reset

XP

Vista

7, 8, 10

rmdir

Deletes a directory

XP

Vista

7, 8, 10

rd

Deletes a directory

XP

Vista

7, 8, 10

rsm

Removable media (e.g. CD-ROMs) can be administered or managed

XP

 

 

schtasks

Planned tasks on the current or remote computer can be created, changed, run or closed

XP

Vista

7, 8, 10

secedit

Authorizations can be compared by means of templates with this in order to check system security

XP

Vista

7, 8, 10

set

Makes it possible to read and delete variables inside the prompt

XP

Vista

7, 8, 10

shutdown

The computer can be logged out, restarted or turned off

XP

Vista

7, 8, 10

sort

Sorts the current task of a read file or standard input

XP

Vista

7, 8, 10

start

Some windows, certain programs or commands can be started

XP

Vista

7, 8, 10

subst

With this command, a path can be directed to a drive label (e.g. “C:”)

XP

Vista

7, 8, 10

systeminfo

Information about the system configuration of the computer can be queried

XP

Vista

7, 8, 10

taskkill

Used to immediately close active processes

XP

Vista

7, 8, 10

tasklist

Retrieves all active tasks and processes

XP

Vista

7, 8, 10

tcmsetup

The telephone client can be established with this

XP

Vista

7, 8, 10

telnet

Telnet connections can be established with this

XP

 

 

tftp

With TFTP, files on a TFTP server can be transferred

XP

 

 

time

Sets or displays the system time

XP

Vista

7, 8, 10

timeout

A chosen period of time can be set in which nothing will happen

 

Vista

7, 10

title

The title of the prompt window can be established with this

XP

Vista

7, 8, 10

tree

Graphic display of the file structure

XP

Vista

7, 8, 10

type

The contents of text files can be displayed with this

XP

Vista

7, 8, 10

ver

The current version of the operating system can be displayed

XP

Vista

7, 8, 10

verify

Verifies whether files have been written onto the data carrier correctly

XP

Vista

7, 8, 10

vol

The label and serial number of a data carrier can be displayed with this

XP

Vista

7, 8, 10

 


We’re all in this together. IONOS is
#HereForYou
For your business. When times are tough. When it matters most.
Keep your business going or start one with your own online store.
3 months free
Online Store
Get started in the world of eCommerce free for 3 months.