Windows CMD Commands
Windows CMD Commands
Basics
CMD Description Windows version
command
call Calls a batch file within another batch file. The All Win/DOS
command has no effect if entered directly into
CMD instead of in a batch file.
chcp Changes the current code page (character set All Win/DOS
table) or shows the page count of the current
code page.
chdir Displays the current directory and lets you All Win/DOS
switch to other directories. With the parameter
/D plus drive and path specification, you can
also switch drives. Use chdir.. to switch to a
higher directory (has the same function as the
cd command).
choice Creates a selection list: typical example is the All Win (not
selection of yes (Y) or no (N), which is created XP)/DOS
with /C YN. With the parameter /M you can add
an explanatory message for the user.
clip Forwards the result of a command to the clip) or the content 10/8/7/Vista
clipboard. For example, you can copy the of a file (clip <
directory structure (dir filename) to the
clipboard.
date Displays the current date and allows you to All Win/DOS
change it. With the parameter /T the date is
shown without the option to change.
dir Displays all folders and files within the current All Win/DOS
directory. You can restrict the output by
attributes (/A), simplify the list (/B), or display all
subdirectories and their files (/S).
edit Starts the MS-DOS editor, with which you can 32-bit/DOS
create text files.
edlin Creates and edits text files within the command 32-bit/DOS
prompt.
help Displays help text for a specific command (you All Win/DOS
can also use the /? command).
logoff Logs the user out of Windows. Also allows you 10/8/7/Vista/XP
to end sessions on servers.
more Outputs the content of a file (for example, a text All Win/DOS
file) by the page. You can also use the
command to split the output of another
command into pages.
path Creates and displays the path for searching All Win/DOS
executable files.
pause Pauses execution in batch files and scripts. The All Win/DOS
user is then prompted in a message to continue
by pressing a key.
print Prints a text file. The device to be used for All Win/DOS
printing has to be specified.
rem Writes comments in batch and script files that All Win/DOS
aren’t taken into account when executing.
rmdir Deletes a directory. This must not contain any All Win/DOS
files, even hidden ones. You can delete an
entire directory tree with the /S parameter (you
can also use the rd command).
shift Moves variables within batch files and scripts. All Win/DOS
sort Lists out data (from a file or command) and All Win/DOS
outputs it again sorted – directly in the
command prompt, in a new file, or in another
output.
Files
CMD Description Windows
command version
append Sets the path in which files will be searched for. 32-bit/DOS
assoc Changes the program that’s linked with a particular file ending. 10/8/7/Vista/XP
attrib Changes attributes of specified files. With the parameter +R you All Win/DOS
can protect a file from changes.
cipher Displays and changes the encryption status of files and 10/8/7/Vista/XP
directories on NTFS partitions.
comp Compares the content of two files or two file sets. The results 10/8/7/Vista/XP
can be displayed as a decimal value (/D) or with ASCII
characters (/A).
compact Displays and changes the compression status of files and 10/8/7/Vista/XP
directories on NTFS partitions.
copy Copies a file or multiple files to another location. It’s also All Win/DOS
possible to connect several files to one. You can use the asterisk
as a wild card.
cscript Runs scripts over the Microsoft Script Host. You can enable All Win/DOS
additional debugging with the /D option.
del Deletes a file or multiple files. If you also want to delete all files All Win/DOS
from subfolders, you can do this with the /S parameter. Read-
only files can be deleted with /F (you can also use the erase
command).
deltree Deletes a directory as well as all subdirectories and files within. 98/95/DOS
diantz Compresses files without any loss (command has the same 7/Vista/XP
function as makecab).
endlocal Ends the valid range of changes to batch files or scripts. After 10/8/7/Vista/XP
the command, changes are applied to the entire system again
(localization is started with setlocal).
expand Extracts files and folders stored in CAB files. All Win (not 64-
bit XP)/DOS
extrac32 Extracts files and folders stored in CAB files. The program is part All Win
of Internet Explorer, but can also be used in the command
prompt.
extract Extracts files and folders stored in CAB files (in new Windows 98/95
versions use expand).
fc Compares two individual files or two sets of files with one All Win/DOS
another and displays the differences.
for Sets a specific command that should be run for each individual All Win/DOS
file in a file set. This command is usually used in batch and script
files.
forfiles Selects one or more files and runs a command that refers to 10/8/7/Vista
these files. Usually used for batch and script files.
ftype Specifies a program for opening a specific file type. 10/8/7/Vista/XP
goto Skips the execution within a batch program to a specific line All Win/DOS
(marker).
makecab Compresses files without loss in CAB format (you can also use 10/8/7/Vista/XP
the diantz command).
mklink Creates a symbolic link to a file. With /D you can also create 10/8/7/Vista
connections to directories. Create a fixed connection instead of a
symbolic connection with /H.
move Moves a file or multiple files from one directory to another. The All Win/DOS
command can also change the names of directories. By default,
the command overwrites other files with the same name when
moving files to the destination. To prevent this use the /-Y
parameter.
openfiles Displays and separates open system files and folders. 10/8/7/Vista/XP
recover Restores readable files that were on a defective data drive. 10/8/7/Vista/XP
ren Changes the name of a particular file. Directory and drive cannot All Win/DOS
be changed this way (or use the rename command).
replace Replaces the selected file or files with one or more other files. All Win/DOS
With /S files in subfolders are also replaced. With the addition /U
files are only replaced if another version is more current. The
parameter /A allows users to add new files to the target directory
at the same time. This parameter is not compatible with /S and
/U.
robocopy Allows so-called robust file copying. This is an extended version 10/8/7/Vista
of copy and xcopy. With robocopy it’s possible to successfully
transfer data even if there are interruptions in the network. There
are a total of 72 parameters with which the copy command can
be modified.
sxstrace Starts the WinSxs Tracing Utility, a tool for programming 10/8/7/Vista
diagnostics.
takeown Restores administrator access rights to a file that have been lost 10/8/7/Vista
when reassigning a user.
verify When enabled, checks whether files are written correctly on a All Win/DOS
data drive. The check is disabled in the standard settings.
where Finds files that match a particular search topic. The placeholders 10/8/7/Vista
* and ? can be used within the topic.
xcopy Copies files and entire directory structures. In this way, the All Win/DOS
command offers various additional options. For example, it can
be specified that only files younger than a specific date (/D)
should be copied. It can also be specified that read-only files are
overwritten (/R).
System
CMD Description Windows
command version
bootcfg Creates, edits, or displays the content of boot.ini (although it’s 10/8/7/Vista/XP
still included in the Windows 7 CMD, it has lost its function
since boot.ini is no longer used for startup options, instead
you should use bcdedit).
bootsect Modifies the master boot code sot that it’s compatible with the 10/8/7/Vista
Windows Boot Manager or NT Loader (can only be started via
system restore in Windows 7 and Vista).
cacls Edits and displays the access control list. This sets access 10/8/7/Vista/XP
rights (outdated – replaced by icacls in newer Windows
versions).
chkdsk Checks and repairs (with the parameter /R) a data drive. All Win/DOS
cmdkey Can display (/list), create (/add), or delete (/delete) login 10/8/7/Vista
information.
ctty Changes the standard input and output for the system. 98/95/DOS
defrag Defragments all or only specified drives. Use /U to observe All Win/DOS
the progress. To get an evaluation statistic after the
defragmentation, use the parameter /V.
diskpart Manages, creates, and deletes partitions from the hard drive. 10/8/7/Vista/XP
dispdiag Creates a file in the current directory in which you’ll find 10/8/7/Vista
information about your display.
dosx Starts the DOS Protected Mode Interface, which allows MS- 32-Bit
DOS programs more than 640 KB of RAM. Is only available to
support older DOS programs.
fdisk Creates, deletes, and manages partitions on the hard drive. 98/95/DOS
Use diskpart in newer Windows versions.
format Formats a drive to the file system specified by the user. All Win/DOS
fsutil Provides numerous features related to the file system, such 10/8/7/Vista/XP
as disk removal.
icacls Edits and displays the access control list. This sets access 10/8/7/Vista
rights. An outdated version of this command is cacls.
lh Loads a program into the high memory area (UMB) – has the 98/95/DOS
same function as loadhigh.
licensingdiag Creates an XML and a CAB file that contain information on 10/8
the Windows product license.
loadfix Ensures that a program is loaded and executed above the 32-bit/DOS
first 64 KB of RAM.
lodctr Updates all registry entries that have to do with performance All Win
indicators.
logman Creates and manages event trace sessions and performance 10/8/7/Vista/XP
logs.
manage-bde Configures drive encryption with BitLocker. Use -on to encrypt 10/8/7
a drive. Use -off to decrypt it again and end BitLocker
protection.
mem Displays information about the RAM and indicates which 32-bit/DOS
programs are currently loaded in it.
mode Configures system devices – primarily on the COM or LPT All Win/DOS
port.
mofcomp Analyzes files in managed object format (MOF) and adds the All Win
classes and instances to the WMI repository.
mountvol Creates and deletes mount points for drives and displays 10/8/7/Vista/XP
them.
msd Starts the program Microsoft Diagnostics, with which system DOS
information can be displayed.
msiexec Starts the Windows installer, with which Windows can be 10/8/7/Vista/XP
installed and configured.
muiunattend Starts an automatic setup process for the multilingual user 10/8/7/Vista
interface (MUI).
netcfg Installs the minimal operating system Microsoft Windows PE. 10/8/7/Vista
pkgmgr Installs, uninstalls, and configures packages and functions for 10/8/7/Vista
Windows.
pwlauncher Configures the startup options for Windows To Go with which 10/8
you can boot Windows from a USB drive.
reg Manages the registry of the command prompt. Users can 10/8/7/Vista/XP
create new keys (reg add) or delete them (reg delete).
relog Creates new performance indicator protocols from the data in 10/8/7/Vista/XP
the existing protocols.
repair-bde Repairs and decrypts defective drives that are encrypted with 10/8/7
BitLocker. The files should be saved on a replacement drive.
reset Resets a session. You can also use the rwinsta command. 10/8/7/Vista/XP
restore Restores backups that were created with the backup DOS
command (replaced by msbackup).
scanreg Repairs the registry and allows a backup to be created of it. 98/95
sfc Checks all important and protected system files. Incorrect 10/8/7/Vista/XP
versions are replaced by correct ones.
smartdrv Starts and manages the hard drive cache program 98/95/DOS
SMARTDrive.
sys Copies system files from MS-DOS and the command 98/95/DOS
interpreter to another hard drive. This makes it bootable.
tpmvscmgr Creates and deletes TPM virtual smart cards. These are 10/8
virtual smartcards encrypted on the basis of the Trusted
Platform Model.
tracerpt Processes logs or real-time data generated during the tracing 10/8/7/Vista/XP
of computer programs.
unformat Undoes the drive formatting done by the format command. DOS
unlock Unlocks a drive that was locked with the lock command. 98/95
vol Displays the label and serial number of a drive. All Win/DOS
vssadmin Manages the volume shadow copy services that can be used 10/8/7/Vista/XP
to store different versions (snapshots) of drives.
winmgmt Manages WMI repositories. Backups (/backup) are possible All Win
with the command, for example.
Network
CMD command Description Windows
version
arp Displays and edits entries in the Address Resolution All Win
Protocol cache.
change Changes the settings of a terminal server and can be used 10/8/7/Vista
together with the parameters logon, port, or user (replaces
the commands chglogon, chgport, and chgusr).
checknetisolation Checks the network capability of apps from the Windows 10/8
Store.
ftp Transfers data to an FTP server or from this to a PC. The All Win/DOS
command offers additional options: For example, you can
activate debugging with -d.
getmac Displays the MAC address of all network adapters. The 10/8/7/Vista/XP
format of the output (Table, List, CSV) is set with /FO. With
/S you can use the command on remote systems as well.
intersvr Starts an interlnk server and transfers data from one DOS
computer to another via serial or parallel connection.
iscsicli Manages iSCSI, which enables connections via the SCSI 10/8/7/Vista
protocol.
mount Enables network sharing under the Network File System. 7/Vista
(To use the command, enable NFS services).
netsh Starts the network shell, which allows for network settings 10/8/7/Vista/XP
to be changed on local and remote computers.
nfsadmin Manages NFS servers and clients (to be able to use the 7/Vista
command, you first have to enable NFS services in
Windows).
ping Sends an internet control message protocol echo request All Win
to a specific host to check if it’s accessible. The duration of
the echo can also be specified. Ping signals can be sent
continuously with -t. To display statistics on this action,
press Ctrl + Brk. Cancel the process with Ctrl + C.
rasdial Starts and ends network connections for Microsoft clients. 10/8/7/Vista/XP
route Displays routing tables and makes it possible to change, All Win
add, or delete entries.
rpcinfo Sends a remote procedure call (RPC) to an RPC server. 7/Vista
The result displays the programs on the remote computer
(to use the command, NFS services on Windows have to
be enabled first).
rpcping Sends a ping via remote procedure call (RPC) and checks 10/8/7/Vista
whether a connection is possible.
rsh Runs commands on remote computers that are running the 7/Vista/XP
Unix program Remote Shell (RSH).
setspn Creates, deletes, and changes SPNs. These are unique 10/8/7
identifiers for services on a network that uses Kerberos
authentication.
showmount Provides information on NFS file systems (to use the 7/Vista
command, you first have to activate NFS services in
Windows).
telnet Enables communication with another computer that also All Win/DOS
uses the telnet protocol.
tftp Enables a file exchange between the local computer and a 10/8/7/Vista/XP
server that supports the Trivial File Transfer Protocol
(TFTP). To use the command, the TFTP client first needs
to be enabled in the system settings.
tracert Tracks a data package on the way through the network to a All Win
server. It doesn’t only check whether the package arrives
and how long it takes, but also records how many hops the
package makes on the way. All packages have a set time-
to-live (TTL), which is increased gradually with the
command.
tscon Connects the current local user session with a session on a 10/8/7/Vista/XP
remote computer.
tsdiscon Ends the connection between a local user session and a 10/8/7/VistaXP
session on a remote computer.
tskill Ends a process on a remote computer. 10/8/7/Vista/XP
umount Removes mounted network file system drives. To use the 7/Vista
command, the NFS functions first have to be enabled in the
system settings.