Enter your email address below and subscribe to our newsletter

Windows Command Line Cheat Sheet

Share your love

Now that you’ve arrived get ready to tackle the command line with confidence! You’re in the right place if you’re looking to become a master of the command line interface for Windows operating systems. No matter if you already have some basic knowledge or if this is your first foray into CLI, our guide has everything you need to help make you an efficient and productive user.

How to use the Command Line?

To begin using the command line, you must first open a command prompt. You can do this by pressing the Windows key + R on your keyboard, typing “cmd” in the Run dialog box, and hitting Enter.

Opening a command prompt is the first step in performing many technological tasks. You can explore your computer’s file system from there by supplying simple commands.

How to Open Command Prompt in Windows 11  (7 Ways Explained)

Command Line Setup Commands

cls Clear the Command prompt window.
cmd Start a new instance of the command interpreter.
color Change the current session’s foreground and background colors in the Command Prompt window.
exit Quit and close the command prompt.
help Display a list of the available commands.
prompt Change the Cmd.exe command prompt.
title Set the Cmd.exe window title.

File and Folder Management

You can quickly navigate through your files and folders, create new directories, and copy or move files between locations. Taking the time to learn these essential commands will save you a huge amount of time while keeping file organization simple and efficient.

assoc Fix file associations.
attrib Change file attributes.
cd (or chdir) Change the current working directory.
comp Perform a comparison of multiple files.
compact Copy files from one location to another.
del (or erase) Delete files.
dir List files and subfolders.
expand Expand compressed files.
fc File compare.
find Filter a string in files.
findstr Search for patterns of text in files.
md (or mkdir) Create a directory or subdirectory.
move Move files from one directory to another.
openfiles Display the currently open files list or disconnect opened files/folders.
print Send a text file to a printer.
rd (or rmdir) Delete a directory.
ren (or rename) Rename a file or directory.
replace Replace existing or add new files to a directory.
robocopy Copy file data from one location to another.
tree Display the tree structure of a directory.
type Display the contents of a text file.
xcopy Copy files and directories.

Disk & Partition Commands

active Mark the partition with focus as active.
chkdsk Check disk.
chkntfs Display or modify automatic disk checking when the computer is started.
clean Remove all partitions or volume formatting from the disk with focus.
convert Convert a disk from one disk type to another.
create Create a partition or volume.
defrag Locates and consolidates fragmented files on local volumes.
delete Delete a partition or a volume.
detail Display information about the selected disk.
diskcomp Compare the contents of two floppy disks.
diskcopy Copy the content of the disk.
diskpart Manage computer disks and drives.
diskperf Start or stop disk performance counters for Performance Monitor.
extend Extend a partition or a volume.
format Format a disk to accept Windows files.
freedisk Check to see if the specified amount of disk space is available before continuing with the installation process.
fsutil Perform tasks that are related to FAT and NTFS file systems.
gpt Assign gpt attribute(s) to a partition.
label Create, change, or delete the volume label of a disk.
list Display a list of disks.
recover Recover readable information from a bad or defective disk.
vol Display the disk volume label and serial number.

System Information, and Configuration

date Display or set the system date.
driverquery Display device driver status and properties.
hostname Display the computer hostname.
powercfg Power configuration.
shutdown Turn off the computer.
systeminfo Display computer system information.
time Display or set the system time.
ver Display Windows system version number.

 

Network Commands

arp Display and modify entries in the ARP cache.
bitsadmin Create, download, or upload jobs and monitor their progress.
dnscmd Manage DNS servers.
ftp Connect to and use FTP.
getmac Return the MAC address.
ipconfig IP configuration.
ipxroute Display and modify information about the routing tables used by the IPX protocol.
irftp Sends files over an infrared link.
jetpack Compact a WINS or DHCP database.
netsh Network Shell utility.
netstat Display network statistics.
net use Connect/disconnect a computer to/from a shared resource
ping View the computer name and the IP address of an endpoint computer.
tracert Determine the route to a destination by sending ICMP packets to the destination.

Smart Ways to Use the Command Prompt

Wired has an interesting piece of content showing useful ways to use the Command Prompt. Some of our favorites:

Shutdown Timer

If you want to shut down your computer after a certain length of time, but the program you are using doesn’t have a built-in option for this, don’t worry; the command prompt can help!

With a simple command, you can set up your system to turn itself off after one hour (or any other predetermined amount of time – it’s totally up to you). All you need to do is open the command prompt on your computer and type in the given command. It’s that easy – no complex setup, no hassle.

So the next time you have a process running, and you need the computer to turn itself off afterward, just use the command prompt – it’s a great way to save time and make sure everything runs smoothly.

shutdown -s -t 3600

“Shutdown” is the main command to use when you want to turn off or restart your computer according to a schedule. You can add different flags, like -s for shutdown or -r for restart, and then add a time value with the -t flag.

That way, you can choose how long until your computer hibernates itself. 3600 seconds equals one hour, but you can adjust this value however you need – so if two hours is better for your schedule, just update the number to 7200 seconds!

If you want to cancel that timer altogether, simply run another command – shutdown -a – in a Command Prompt. Easy peasy!

How to View a Saved Wi-Fi Password

Backing up information like passwords is important, and that’s why so many of our Wi-Fi networks are password-protected. However, even though they’re protected, we sometimes forget what that password was!

If you’ve ever been in this situation where you know the network is saved on your Windows laptop, but you can’t recall the password for your other devices, there’s a simple command you can run to reveal the saved password.

All it takes is going into the Network Status menu of the laptop if you’re connected to it or running a particular command if you aren’t, and then voila – suddenly, you know what that elusive password is!

netsh wlan show profile YourWifiName key=clear

Final words

A big high five for using our site! We know mastering the command line can be daunting, but the great news is that the Windows command line interface has a range of features and commands which can help you become actively more productive.

With our cheat sheet, you have all the information you need to start using it confidently.

 

 

Share your love
Gyula Virag
Gyula Virag

Gyula is a developer and a passionate geek father with a deep love of online marketing and technology. He always seeks challenging adventures and opportunities to create something permanent in the digital world.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!