DEV Community

Cover image for Windows Commands CheatSheet you needed
Jatin Sharma
Jatin Sharma

Posted on • Originally published at

Windows Commands CheatSheet you needed

This is the Cheat Sheet of Windows Commands. It gives you all the commands and a short description of the command. I've also attached the documentation link for further reading.

What is Command Prompt in Windows?

Command Prompt, also known as cmd.exe is a command line interpreter application on Windows Operating System. It's used to execute entered commands.

What are the CMD Commands?

CMD Commands are the specific set of instructions given to Command Prompt to perform some kind of task or function on a Windows PC. Most of the Windows commands are used to automate tasks via scripts and batch files and perform advanced administrative tasks or functions. Many commands can help you troubleshoot and solve certain problems on windows.

Windows Commands List

Commands Functions
arp Displays and modifies the Internet-to-adapter address translation tables used by the Address in Networks and communication management
assoc Displays or modifies file name extension associations
attrib Displays, sets, or removes attributes assigned to files or directories.
bcdboot Enables you to quickly set up a system partition, or to repair the boot environment located on the system partition
bcdedit Used to manage boot configuration data
bitsadmin Used to manage the Background intelligent Transfer Service
break Enable/Disable break copability CTRL+C\ in CMD
cacls Used to change permissions of files
call Used one batch program to call another
certreq Used to request certificates from a certification authority
certutil Manage Certification Authority files and Services
cd Used to change directory or go to a specific one
chcp Displays the number of active console code page
chdir Same as cd command
chkdsk Used to check and repair issues in the disk
chkntfs Used to check the NTFS file system
choice Prompts the user to select one item from a list of single-character choices in a batch program, and then returns the index of the selected choice. If used without parameters, choice displays the default choices Y and N.
cipher Used to encrypt/decrypt file and folder
cleanmgr Used to clean temp files and recycle bin automatically
clip Copy result of any command to windows clipboard
cls Clear CMD screen
cmd Used to start a new CMD shell
cmdkey Creates, lists, and deletes stored user names and passwords or credentials.
cmstp Used to install or remove a connection manage service profile
color Change the color of the CMD shell using options
comp Compare contents of two files or two sets of files
compact Displays or alters the compression of files or directories on NTFS partitions
covert Converts a disk from one disk type to another.
copy Copy one or more files to another location
date Displays or sets the system date.
defrag Locates and consolidates fragmented files on local volumes to improve system performance.
del Deletes one or more files.
dir Used to display files and folder list
diskpart helps you manage your computer's drives (disks, partitions, volumes, or virtual hard disks)
dispdiag Logs display information to a file.
doskey Recalls previously entered command-line commands, edits command lines, and creates macros.
driverquery Display a list of installed device drivers and their properties
echo Displays messages or turns on or off the command echoing feature
endlocal Ends localization of environment changes in a batch file
erase Used to delete one or more file
eventcreate Enables an administrator to create a custom event in a specified event log
exit Exits the command interpreter or the current batch script.
expand Expands one or more compressed files
extrac32 Extracts files from a cabinet or source.
fc Compares two files or sets of files and displays the differences between them.
find Searches for a string of text in a file or files, and displays lines of text that contain the specified string
findstr Searches for patterns of text in files
finger Displays information about users on a specified remote computer
fondue Enables Windows optional features by downloading required files from Windows Update or another source specified by Group Policy
for Runs a specified command for each file, within a set of files
forfiles Selects and runs a command on a file or set of files. This command is most commonly used in batch files
format Format a disk to accept Windows files. You must be a member of the Administrators group to format a hard drive
fsutil File System utility to manage file and drive properties
ftp Use FTP service to transfer files from one PC to another
ftype Display/Modify file extensions type associations
getmac Used to display the MAC address of your network adapter
goto Used to direct a batch program to a line identified by a label
gpresult Display Group Policy Settings and Resultant Set of Policy for a user
gpupdate Updates Group Policy settings
help Displays a list of the available commands or detailed help information on a specified command
hostname Displays the hostname portion of the full computer name of the computer
icacls Displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories
if Performs conditional processing in batch programs
ipconfig Display and change windows IP Configuration
klist Displays a list of currently cached Kerberos tickets
ktmutil Starts the Kernel Transaction Manager utility
label Used to change the name of a disk
lodctr Allows you to register or save performance counter name and registry settings in a file and designate trusted services
logman Used to manage performance monitor logs
logoff Log a use off
makecab Package existing files into a cabinet (.cab) file
md Creates a directory or subdirectory
mkdir Creates a directory or subdirectory
mklink Creates a directory or file symbolic or hard link
mmc Access Microsoft Management Console
mode Displays system status, changes system settings, or reconfigures ports or device
more Displays one screen of output at a time
mountvol Creates, deletes, or lists a volume mount point. You can also link volumes without requiring a drive letter
move Moves one or more files from one directory to another directory
msdt Invokes a troubleshooting pack at the command line or as part of an automated script, and enables additional options without user input
msiexec Provides the means to install, modify, and perform operations on Windows Installer from the command line
msinfo32 Display system information
mstsc Create a remote Desktop connection
nbtstat Displays NetBIOS over TCP/IP (NetBT) protocol statistics
netcfg Installs the Windows Preinstallation Environment (WinPE), a lightweight version of Windows used to deploy workstations
net print Displays information about a specified printer queue or a specified print job, or controls a specified print job
netsh Display or modify network configuration
net Used to manage network resources and services
netstat Display active TCP/IP connections
nslookup Displays information that you can use to diagnose Domain Name System (DNS) infrastructure
openfiles Queries or display open files
path Set PATH environment variable for executable files
pathping Latency and packet loss info for each node in the network path
pause Used to stop processing of a batch file
perfmon Access Performance monitor in CMD
ping Test network connection to a computer
pktmon Used for advanced packet capture and event collection, drop detection, filtering, and counting
pnpunattend Audits a computer for device drivers, and performs unattended driver installations, or searches for drivers without installing and, optionally, report the results to the command line
pnputil Used to manage the driver store
popd Go to the latest path/folder stored by the PUSHD command
powerShell Access Powershell
powerShell_ise Windows PowerShell Integrated Scripting Environment (ISE) is a graphical host application that enables you to read, write, run, debug, and test scripts
print Used to print a text file from CMD
powercfg Used to configure power settings and know battery health
prompt Displaying any text you want, such as the name of the current directory, the time and date, etc.
pushd Stores the current directory for use by the popd command, and then changes to the specified directory
pwlauncher Enables or disables the Windows To Go Startup Options
rd Deletes a directory
recover Recovers readable information from a bad or defective disk
ReFSUtil ReFSUtil is a tool included in Windows and Windows Server that attempts to diagnose heavily damaged ReFS volumes
reg Performs operations on registry subkey information and values in registry entries
regini Modifies the registry from the command line or a script, and applies changes that were present in one or more text files
regsvr32 Registers .dll files as command components in the registry
relog Extracts performance counters from performance counter logs into other formats, such as text-TSV (for tab-delimited text), text-CSV (for comma-delimited text), binary-BIN, or SQL
rem Records comments in a script, batch, or config.sys file. If no comment is specified, rem adds vertical spacing
ren Renames files or directories
rename Renames files or directories
replace Replace existing files in a directory. If used with the /a\ option, this command adds new files to a directory instead of replacing existing files
rmdir Deletes a directory
robocopy Copies file data from one location to another
route Displays and modifies the entries in the local IP routing table
rpcping Confirms the RPC connectivity between the computer running Microsoft Exchange Server and any of the supported Microsoft Exchange Client workstations on the network
rundll32 Loads and runs 32-bit dynamic-link libraries (DLLs)
rasdial Display Remote Access Service Status
runas Run a program as different user
sc Use Service Controller to manage Windows services
schtasks Schedules commands and programs to run at a specific time
secedit Configures and analyzes system security
set Displays, sets, or removes cmd.exe\ environment variables
setx Creates or modifies environment variables in the user or system environment, without requiring programming or scripting
sfc Scans and verifies the integrity of all protected system files and replaces incorrect versions with correct versions
shift Changes the position of batch parameters in a batch file
shutdown Enables you to shut down or restart local or remote computers, one at a time.
sort Reads input, sorts data, and writes the results to the screen, to a file, or another device
start Starts a separate Command Prompt window to run a specified program or command
subst Associates a path with a drive letter
sxstrace Diagnoses side-by-side problems
systeminfo Displays detailed configuration information about a computer and its operating system
strings Find ANSI and UNICODE strings in binary files
takeown Used to take the ownership of a file
taskkill Ends one or more tasks or processes
tasklist Displays a list of currently running processes on the local computer or a remote computer
tcmsetup Enable/Disable the TAPI client
telnet Communicates with a computer running the telnet server service
time Displays or sets the system time
timeout Pauses the command processor for the specified number of seconds
title Creates a title for the Command Prompt window
tpmtool This utility can be used to get information about the Trusted Platform Module (TPM).
tpmvscmgr The tpmvscmgr command-line tool allows users with Administrative credentials to create and delete TPM virtual smart cards on a computer
tracerpt The tracerpt command parses Event Trace Logs, log files generated by Performance Monitor, and real-time Event Trace providers
tracert Trace route to a remote host by sending ICMP request messages
tree Displays the directory structure of a path or of the disk in a drive graphically
type Displays the contents of a text file
typeperf writes performance data to the command window or to a log file
tzutil Displays the Windows Time Zone utility
unlodctr Removes Performance counter names and Explains text for a service or device driver from the system registry
ver Displays the operating system version number
verifier Driver Verifier monitors Windows kernel-mode drivers and graphics drivers to detect illegal function calls or actions that might corrupt the system
verify Verify whether files are saved correctly on the disk
vol Displays the disk volume label and serial number
vssadmin Show shadow copy backups, installed shadow copy writers and providers
wbadmin Enables you to back up and restore your operating system, volumes, files, folders, and applications from a command prompt
waitfor Sends or waits for a signal on a system
wecutil Enables you to create and manage subscriptions to events that are forwarded from remote computers
wevtutil Enables you to retrieve information about event logs and publishers
where Displays the location of files that match the given search pattern
whoami Displays user, group, and privileges information for the user who is currently logged on to the local system
winrs Windows Remote Management allows you to manage and execute programs remotely
winrm Windows Remote Management
wmic Displays WMI information inside an interactive command shell.
wscript Windows Script Host provides an environment in which users can execute scripts in a variety of languages that use a variety of object models to perform tasks
xcopy Copies files and directories, including subdirectories
:: Comment

Wrapping up

There are many more commands that I might have missed. If you enjoyed this article then don't forget to press ❤️ & SAVE FOR LATER USE ⌛. If you have any queries or suggestions don't hesitate to drop them. You can extend your support by Buying me a Coffee

You might be interested in JavaScript Cheat Sheet

Top comments (6)

dendihandian profile image
Dendi Handian

is there any linux's touch equivalent command in windows?

loucyx profile image
Lou Cyx

Closest thing:

echo. > filename
Enter fullscreen mode Exit fullscreen mode

It sucks.

j471n profile image
Jatin Sharma

There are many ways you can do that:

echo. > script.js 
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file as Luke mentioned, but the file will be override by the empty if the file already exists.

type nul > filename.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but the file will also be override by the empty if the file already exists.

type nul >> filename.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but file will not be override by the empty file if the file already exists.

call >> filename.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but file will not be override by the empty file if the file already exists.

New-Item script.txt
Enter fullscreen mode Exit fullscreen mode

The above command will create a new file, but file will not be override by the empty file if the file already exists. (only works in Power Shell)

notepad index.html
Enter fullscreen mode Exit fullscreen mode

This command will create/open the file in notepad (not recommended)

Enter fullscreen mode Exit fullscreen mode

This command will give you ERROR ('$' is not recognized as an internal or external command,) but it will create a file (does not override the contents of the file already exists)

Enter fullscreen mode Exit fullscreen mode

This command will give you ERROR ('.' is not recognized as an internal or external command,) but it will create a file (it does override the contents if the file already exists)

There could be more, But I guess these are more than enough. If you ask me which one I use the it would be $>>filename.js .

I hope it helps.

dendihandian profile image
Dendi Handian

wow thank you for this much help, I appreciate that 😁

Thread Thread
j471n profile image
Jatin Sharma

It's my pleasure 😊

devarshishimpi profile image
Devarshi Shimpi

Loved it!!