Windows Cmd CHEAT SHEET

This Windows Command Cheat Sheet is a non-exhaustive list of the main Windows commands you can use.

command
6
Sections
8
Cards

#Getting Started

Basic
CMDDescription
clsClears the content of the screen.
echoDisplays messages or enables/disables command echoing.
helpProvides help information for Windows commands.
exitExits the CMD.EXE program (command interpreter).
dateDisplays or sets the date.
timeDisplays or sets the system time.
verDisplays the Windows version.
dirDisplays a list of files and subdirectories in a directory.
cdDisplays the name of or changes the current directory.
copyCopies one or more files to another location.
moveMoves files and renames files and directories.
delDeletes one or more files.
mkdirCreates a directory.
rmdirRemoves a directory.
typeDisplays the contents of a text file.
renRenames a file or files.
startStarts a separate window to run a specified program or cmd.
shutdownAllows you to shut down or restart the computer.
tasklistDisplays all currently running tasks including services.
taskkillEnds one or more tasks or processes.

#Manage files:

File
CMDDescription
attribDisplays or changes file attributes.
fcCompares two files and displays the differences between them.
findSearches for a text string in a file or files.
findstrSearches for strings in files.
xcopyCopies files and directory trees.
robocopyRobust File Copy for Windows, a more advanced version of xcopy.
compactDisplays or alters the compression of files on NTFS partitions.
expandExpands one or more compressed files.
replaceReplaces files.
treeGraphically displays the folder structure of a drive or path.
sortSorts input.
moreDisplays output one screen at a time.
printPrints a text file.
cipherDisplays or alters the encryption of dir files on NTFS parts.
diskcompCompares the contents of two floppy disks.
diskcopyCopies the contents of one floppy disk to another.
formatFormats a disk for use with Windows.
chkdskChecks a disk and displays a status report.
labelCreates, changes, or deletes the volume label of a disk.
recoverRecovers readable information from a bad or defective disk.

#System & Network

System
CMDDescription
systeminfoDisplays detailed configuration information about a computer and its operating system.
driverqueryDisplays current device driver status and properties.
msinfo32Starts the System Information tool.
regRegistry Console Tool, used to manage the Windows Registry.
scDisplays or configures services (background processes).
taskmgrStarts the Task Manager.
wmicWindows Management Instrumentation, used for managing Windows systems.
sfcSystem File Checker, scans and verifies the versions of all protected system files.
gpupdateRefreshes local and Active Directory-based Group Policy settings.
gpresultDisplays Group Policy settings and Resultant Set of Policy (RSoP) for a user or computer.
powercfgConfigures power settings.
dxdiagStarts the DirectX Diagnostic Tool.
perfmonStarts the Performance Monitor.
rsopResultant Set of Policy, used to view Group Policy settings.
sigverifStarts the File Signature Verification tool.
syseditStarts the System Configuration Editor.
syskeySecures the Windows XP account database.
chgportDisplays or changes Com port mappings.
chgusrChanges the installed user mode.
Network
CMDDescription
ipconfigDisplays all current TCP/IP network configuration values.
pingTests network connectivity to a specified host.
tracertTraces the route taken by packets to a specified destination.
netstatDisplays active TCP connections, ports on which the computer is listening.
nslookupDisplays information that you can use to diagnose Domain Name System (DNS) infrastructure.
netManages network resources, services, and user accounts.
netshNetwork Shell, used to configure and monitor network devices.
arpDisplays and modifies the IP-to-Physical address translation tables used by the Address Resolution Protocol (ARP).
routeDisplays and modifies the entries in the local IP routing table.
ftpStarts the File Transfer Protocol (FTP) client.
telnetStarts the Telnet client.
nbtstatDisplays protocol statistics and current TCP/IP connections using NBT (NetBIOS over TCP/IP).
net useConnects to, disconnects from, and displays information about network connections.
net sessionManages server computer connections.
net startStarts a network service.
net stopStops a network service.
net viewDisplays a list of resources being shared on a specified computer.
net userManages user accounts.
net localgroupManages local groups.
net shareManages shared resources.
net statisticsDisplays network statistics.

#Miscellaneous

Process Management
CMDDescription
wmic processManages processes using Windows Management Instrumentation .
timeoutWaits for specified number of seconds / until a key pressed.
Disk Management
CMD CommandDescription
diskpartManages disk partitions.
defragDefragments a disk.
convertConverts a FAT volume to NTFS.
diskperfManages disk performance counters.
System Configuration
CMD CommandDescription
bcdeditManages the Boot Configuration Data (BCD) store.
bootcfgConfigures, queries, or changes Boot.ini file settings.
msconfigStarts the System Configuration utility.
regeditStarts the Registry Editor.

#Tips & Tricks

Miscellaneous Tips & Tricks
Tip or TrickDescription
wmic path SoftwareLicensingService get OA3xOriginalProductKeyGet your Windows Product key
cmd /kOpens the command prompt and executes a specified command, keeping the window open.
cmd /cOpens the command prompt, executes a specified command, and then closes the window.
&&Allows you to run multiple commands in sequence. For example, command1 && command2.
||Allows you to run a second command only if the first command fails. For example, command1 || command2.
>Redirects the output of a command to a file, overwriting the file if it already exists. For example, command > output.txt.
>>Redirects the output of a command to a file, appending the output if the file already exists. For example, command >> output.txt.
|Pipes the output of one command to another command. For example, command1 | command2.
clipRedirects the output of a command to the Windows clipboard. For example, dir | clip.
for %i in (*.txt) do echo %iLoops through all .txt files in the current directory and echoes their names.
pushd and popdpushd saves the current directory and then changes to a new directory. popd returns to the saved directory.
setDisplays, sets, or removes environment variables. For example, set PATH=C:\newpath.
start "" "C:\Path\To\Program\program.exe"Starts a program without waiting for it to finish.
taskkill /IM "process.exe" /FForcefully kills a process by its image name.
wmic product get nameLists all installed software on the system.
wmic logicaldisk get size,freespace,captionDisplays the size, free space, and caption of all logical disks.
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"Displays the OS name and version.
schtasks /query /fo LIST /vLists all scheduled tasks in detail.
netsh wlan show profilesDisplays a list of all saved Wi-Fi profiles.
netsh wlan show profiles name="ProfileName" key=clearDisplays the password for a specific Wi-Fi profile.
assocDisplays or modifies file extension associations.
ftypeDisplays or modifies file types used in file extension associations.
driverquery /vLists all installed drivers with detailed information.
powercfg /energyGenerates a detailed energy report for the system.
powercfg /batteryreportGenerates a battery life report for laptops.
robocopy C:\Source D:\Destination /MIRMirrors a directory from one location to another, including subdirectories and files.
mklink /D "C:\Path\To\Link" "C:\Path\To\Target"Creates a symbolic link to a directory.
mklink /H "C:\Path\To\Link" "C:\Path\To\Target"Creates a hard link to a file.
mklink /J "C:\Path\To\Link" "C:\Path\To\Target"Creates a directory junction.
diskpart /s script.txtRuns a DiskPart script to automate disk partitioning tasks.
shutdown /aAborts a system shutdown.
chkdsk /f /rChecks a disk and fixes errors, also recovers readable information from bad sectors.
sfc /scannowScans and repairs protected system files.
DISM /Online /Cleanup-Image /RestoreHealthRepairs the Windows image using DISM.
bcdboot C:\WindowsRepairs the boot environment by copying boot files from the Windows directory.
bootrec /fixmbrRepairs the Master Boot Record (MBR).
bootrec /fixbootWrites a new boot sector to the system partition.
bootrec /scanosScans for installations compatible with Windows and displays the entries that are currently not in the Boot Configuration Data store.
bootrec /rebuildbcdScans for installations compatible with Windows and allows you to select the installations you want to add to the Boot Configuration Data store.

#Other