The Windows command line is one of the most powerful utilities on a Windows PC. With it, you can interact with the OS directly and do a lot of things not available in the graphical user interface (GUI).
In this article, I’ll show you 40 commands you can use on the Windows command line that can boost your confidence as a Windows user.
N.B.: You have to be careful while using the commands I’ll show you. This is because some commands can have a lasting negative or positive effect on your Windows PC until you reset it.
In addition, some of these commands require you to open the command prompt as an admin.
Windows Command Line Commands
powershell start cmd -v runAs – Run the Command Prompt as an Administrator
Entering this command opens another command prompt window as an administrator:
driverquery – Lists All Installed Drivers
It is important to have access to all drivers because they often cause problems.
That’s what this command does – it shows you even the drivers you won’t find in the device manager.
cd – Changes the Current Working Directory to the Specified Directory
systeminfo – Shows Your PC’s Details
If you want to see more detailed information about your system you won’t see in the GUI, this is the command for you.
set – Shows your PC’s Environment Variables
prompt – Changes the Default Text Shown before Entering Commands
By default, the command prompt shows the C drive path to your user account.
You can use the
prompt command to change that default text with the syntax
prompt prompt_name $G:
N.B: If you don’t append
$G to the command, you won’t get the greater than symbol in front of the text.
clip – Copies an Item to the Clipboard
dir | clip copies all the content of the present working directory to the clipboard.
You can type
clip /? and hit
ENTER to see how to use it.
assoc – Lists Programs and the Extensions They are Associated With
title – Changes the Command Prompt Window Title Using the Format
fc – Compares Two Similar Files
If you are a programmer or writer and you want to quickly see what differs between two files, you can enter this command and then the full path to the two files. For example
fc “file-1-path” “file-2-path”.
cipher – Wipes Free Space and Encrypts Data
On a PC, deleted files remain accessible to you and other users. So, technically, they are not deleted under the hood.
You can use the cipher command to wipe the drive clean and encrypt such files.
netstat -an – Shows Open Ports, their IP Addresses and States
ping – Shows a Website IP Address, Lets you Know How Long it Takes to Transmit Data and a Get Response
color – Changes the Text Color of the Command Prompt
color attr to see the colors you can change to:
color 2 changes the color of the terminal to green:
for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear – Shows All Wi-Fi Passwords
ipconfig – Shows Information about PC IP Addresses and Connections
This command also has extensions such as
ipconfig /renew, and
ipconfig /flushdns which you can use to troubleshoot issues with internet connections.
sfc – System File Checker
This command scans your computer for corrupt files and repairs them. The extension of the command you can use to run a scan is
powercfg – Controls Configurable Power Settings
You can use this command with its several extensions to show information about the power state of your PC.
You can enter
powercfg help to show those extensions.
For example, you can use
powercfg /energy to generate a battery health report.
powercfg /energy command will generate an HTML file containing the report. You can find the HTML file in
dir – Lists Items in a Directory
del – Deletes a File
attrib +h +s +r folder_name – Hides a Folder
You can hide a folder right from the command line by typing in
attrib +h +s +r folder_name and then pressing
To show the folder again, execute the command
– attrib -h -s -r folder_name.
start website-address – Logs on to a Website from the Command Line
tree – Shows the Tree of the Current Directory or Specified Drive
ver – Shows the Version of the OS
tasklist – Shows Open Programs
You can do the same thing you do with the task manager with this command:
The next command shows you how to close an open task.
taskkill – Terminates a Running Task
To kill a task, run
taskkill /IM "task.exe" /F. For example,
taskkill /IM "chrome.exe" /F:
date – Shows and Changes the Current Date
time – Shows and Changes the Current Time
vol – Shows the Serial Number and Label Info of the Current Drive
dism – Runs the Deployment Image Service Management Tool
CTRL + C – Stops the Execution of a Command
-help – Provides a Guide to other Commands
powercfg -help shows how to use the
echo – Shows Custom Messages or Messages from a Script or File
You can also use the
echo command to create a file with this syntax
echo file-content > filename.extension.
mkdir – Creates a Folder
rmdir – Deletes a Folder
N.B.: The folder must be empty for this command to work.
more – Shows More Information or the Content of a File
move – Moves a File or Folder to a Specified Folder
ren – Renames a File with the Syntax
ren filename.extension new-name.extension
cls – Clears the Command Line
In case you enter several commands and the command line gets clogged up, you can use
cls to clear all entries and their outputs.
exit – Closes the Command Line
shutdown – Shuts down, Restarts, Hibernates, Sleeps the Computer
You can shut down, restart, hibernate, and sleep your PC from the command line.
shutdown in the command line so you can see the extensions you can use to perform the actions. For example, shutdown /r will restart your computer.
This article showed you several “unknown-to-many” commands you can use to get access to hidden functionalities on your Windows PC.
Again, you should be careful while working with these commands because they can have a lasting effect on your OS.
If you find the commands helpful, share the article with your friends and family.
In case you know another useful command I did not list, tell me about it on Twitter. I will add it and mention you as the source.