Not just that, you can also use the Command Prompt to carry out administrative operations or fix certain kinds of system issues on Windows. In short, pretty much any action you can think of doing with Windows’ GUI can probably be done more efficiently with its CLI (Command Line Interface) counterpart, thanks to the Command Prompt. However, to perform any of these actions, you need to be familiar with the Command Prompt commands. In this guide, we’ve put together a list of all such essential commands that you need to know to use the Command Prompt effectively on your Windows PC.

Essential Command Prompt Commands for Windows

Before you dive into the commands, first, launch the Command Prompt. You can do this in a few different ways. However, the easiest way to go about this is to hit Windows + R key to open Run, enter “cmd”, and press Enter. Also, while you’re at it, you should pin Command Prompt to the taskbar so you can easily access it next time. For this, with CMD running, right-click on its icon in the taskbar and select More > Pin to taskbar. With that done, all you have to do now to run a command is to type in the command and hit the Enter key.

1. Find

Find is one of the most useful Windows CMD commands. It lets you search for a string in a file or multiple files and returns the lines that contain the text you specified in your query. So if you’d like to search for a string in a specific file, you’ll need to run: find /i “query_string” path\to\file …where /i is a switch to avoid case-sensitive searching. Eg: find /i “command prompt commands” C:\Users\Dell\Documents\Commands.txt To search for text in multiple documents: find /i “query_string” path\to\file1 path\to\file2 In case you still can’t file your document, you can narrow down your search to a specific set of files: find /i “query_string” *.file_type Eg: find /i “command prompt commands” *.txt

2. Copy con

If you haven’t used the command prompt much before, you’re probably using Windows’ GUI to create new files. Although this is perfectly acceptable, there is another (read efficient) way to accomplish this: it involves running the copy con command in the CMD window to speed up the entire process. To use it, follow the below syntax: copy con file_name_with_extension Eg: copy con MyFile.txt …and start populating the file with text. Once done, hit Ctrl + Z to save the file. Alternatively, if you want to create a single-line text file, you can also use the echo command: echo your_text_here > file_name_with_extension

3. Rename

The rename command enables you to rename files and folders on your computer right from the command line. Run your command in the following syntax to rename a file: rename current_file_name new_file_name Eg: rename File1.txt MyFile.txt If you want to rename the files in other folders, prepend their path before the filename. Eg: rename C:\Users\Dell\Documents\File1.txt File2.txt

4. Copy

As its name suggests, the copy command allows copying file(s) from one location on your system to another. It comes with a few different switches to help you extend its scope of use and put it to use for your different requirements. And, you can even use it to combine multiple files. To copy a file from an existing directory, use the following syntax: copy file_name destination_file Eg: copy MyFile.txt D:\Files When you want to copy a file from a different folder: copy source_file destination_file For copying multiple files of the same type in a folder to another location: copy *.txt D:\Documents Similarly, if there’s a need to combine two files into a new file, enter: copy file_name_1 + file_name_2 file_name_3

5. Move

Using the copy command, you can create a copy of a file on some other location on your computer. Occasionally, however, when you want to relocate a file or directory to a different location and don’t want an extra copy, you need the move command. With move, you can move your files/folders by running: move file_name destination_address or move folder_name destination_address Eg: move MyFile D:\Documents or move MyFolder D:
Do note that you need administrative access on your system to move files/folders around, so make sure you’re running CMD as an administrator before carrying out such operations. You can do this by searching “cmd” in Run and pressing the Ctrl+Shift+Enter keys or by right-clicking on its app icon and selecting Run as administrator.

6. Del

Short for delete, the del command helps you delete files from your computer. You can use it in conjunction with switches to get around deletion restrictions on the system. To delete a file from your current directory, run: del file_name For deleting a file inside a folder: del path\to\file Eg: del D:\Documents\myfile When you want to delete all files in a folder: del path\to\folder Eg: del D:\Documents

7. Mkdir

Similar to the copy con and echo command, which let you create files, Windows also has a similar utility to create folders: it’s called mkdir. Using it, you can create a folder or a subfolder within a folder right from the CMD window. To create a folder in the current working folder, use the following syntax: mkdir folder_name When you want to create a folder in other : mkdir path\to\folder Eg: mkdir D:\Documents\

8. Rmdir

The Rmdir command assists you with deleting a folder or its subfolders on your computer. It also provides a couple of switches to help you in the deleting process. For removing a folder in the current folder, simply run: rmdir folder_name To do it for a folder in another drive: rmdir path\to\folder Eg: rmdir D:\Documents
When there are multiple subfolders and you want to delete all of them at once: rmdir /s path\to\folder Eg: rmdir /s D:\Documents Since the above command prompts for confirmation, you can bypass it by adding the /q switch: rmdir /s /q folder_name

9. Cls

Cls is the most elementary yet significant Command Prompt command. It lets you clear your CMD window that might get crowded with outputs from all the previous commands you’ve run to have a clean slate to work on it again. To clear your Command Prompt window with it, run: cls

10. Dir

When working on the Command Prompt, navigating between different folders is one of the basic tasks you’ll need to do. To this end, Windows has the dir command, which outputs a list of all the folders and their subfolders on your system, so you get an idea about a folder’s content. Not just that, it also returns the total number of files and subfolders along with the free space available on the disk. You can view the files and subfolders inside a folder by running: dir To view a list of all the files of a particular kind: dir *.extension Eg: dir *.txt When you want to view all folders: dir /a Just a list of hidden folders: dir /a:d A list of all the hidden files: dir /a:h

11. Cd

Viewing a list of files and folders on your system is one half of the navigation process; the other requires you to change the folder (or directory). The cd command helps you with just that and features a few different switches to make navigating around a little more convenient. In addition to changing directories, cd also displays the name of your current working directory, so you can run it to know where you are in your file system. For this, simply run: cd Now, if you wish to go to the root directory of the system, you’d enter: cd
To change the directory: cd D: For accessing a particular folder: cd C:\path\to\folder Eg: cd C:\Extras When you want to go to the parent folder of your current folder: cd ..

12. Sfc

Sfc, short for System File Checker, is a built-in utility on Windows operating systems that enables you to scan and restore the corrupted system files on your PC. If your system keeps crashing, shows DLL file errors, or displays the BSoD (Blue Screen of Death), it’s likely suffering from file corruption. And, this is where you can use the sfc command to fix such issues. For scanning your system to identify system file errors, run: sfc /scannow Once the scanning finishes, you’ll get a message showing your system status and whether there’s a need for any fix. You can also use sfc to scan a specific file by running: sfc /scanfile=path\to\file If you just want to scan the integrity without performing repairs: sfc /verifynow Similarly, when you only need to verify the integrity of a particular file: sfc /verifyfile=path\to\file

13. Chkdsk

Similar to sfc, Microsoft also offers another utility called chkdsk (Check Disk), which examines the disk space of your logical or physical drivers to identify its integrity and attempt a fix if there are any errors. It supports various switches that help with scanning and identifying potential parameters for disk failure. To run a simple chkdsk scan on a drive, make sure you’re running CMD with elevated privileges and use the syntax below: chkdsk drive_name /f Eg: chkdsk D: /f If you suspect the drive to have bad sectors: chkdsk drive_name /r …where /r implies /f but also includes checks for bad sectors.

14. Systeminfo

Systeminfo (or System Information) gives you detailed system configuration information about a PC. You can use it to find out details such as the system model, operating system build, BIOS version, RAM, and installed NIC, among others. For this, all you have to do is run the following command: systeminfo To get system information about a remote computer: systeminfo /s hostname_or_IP_address

15. Where

The command’s name is pretty much a giveaway here: it allows you to find the installation directory/path for an app on your PC. So you can find out the installation paths for different programs on your computer and use them whenever required. For instance, when there’s a need to change their default launch programs. Use the following syntax to find out the path for a program: where program_name Eg: where notepad

16. Assoc

Assoc is a powerful CMD command that enables you to change the default associations for the various file extensions on your system. Using it, you can change the default app for opening the different kinds of file types. For instance, if you want to open all the .txt files in Notepad, you can do so right from the Command Prompt. To do this, first, identify the existing association for that file extension by running: assoc .file_extension Eg: assoc .txt Next, make sure you are running CMD as an administrator and find the path for the app that you want to assign. You can do this using the where command. Copy the returned path and use it with the following syntax: assoc .file_extension=path\to\app Eg: assoc .txt=C:\Windows\System32\notepad.exe

17. Driverquery

Windows PCs often run into driver issues, be it when you get a new hardware accessory or when an existing one starts malfunctioning out of the blue. In such situations, getting to know the installed drivers on your system can help you identify the problem and find its fix. The driverquery command helps you with just that: it presents you with a list of all installed drivers on your system. To use it, simply run: driverquery

18. Fc

Fc or File Compare gives you the ability to you compare two files and view the differences between them side by side, right from the Command Prompt. So, if you’re in a situation where you’ve got multiple files with similar text in them, you can run them through fc to identify the differences, if any. Use the syntax below to compare two files: fc /a file_name_1 file_name_2 …where /a signifies ASCII comparison. When you want to compare other kinds of files, like .exe, .sys, .obj, .bin, etc., you’d need to add the /b switch: fc /b file_name_1 file_name_2

19. Ping

Ping is a built-in network management tool on Windows that helps you determine your PC’s connectivity with other devices (computers/servers). So, if you’re facing issues connecting to the internet or another device, you can check your connectivity status by running the ping command in the following syntax: ping hostname Eg: ping google.com or ping IP_address Eg: ping 142.250.192.46 When you want to ping an IP address and resolve to its hostname: ping /a IP_address

20. Tracert

Tracert is a slightly more nuanced network troubleshooting utility than ping: it helps you identify the path between the source and the destination point, so you know the path (involving hops) traversed by the network packets. To trace the path to a hostname, run: tracert IP_address or tracert domain_name If you want to speed up the process, you can use the /d switch, with the following syntax, to prevent tracert from resolving the IP addresses of hops: tracert /d IP_address_or_domain_name

21. Netstat

Netstat (or Network Statistics) takes network troubleshooting up a level over both ping and tracert. It presents you a list of many network connection statistics, such as open ports, active connections (incoming and outgoing), and even the routing table to give you a comprehensive overview of your entire network. It also provides various switches, which you can include in your commands, to get more network statistics. At its most basic level, you can run netstat to get a list of all the connections to/from your PC. But to filter out, say, just the active connections and ports, you’d need to run: netstat -a For viewing ethernet statistics: netstat -e When you want to get the process ID (PID) for each connection: netstat -o To view the routing table: netstat -r

22. Ipconfig

Ipconfig (or IP Configuration) is an important network configuration command that shows you different information about a network, such as its IP address, subnet mask, default gateway, MAC address, DNS server, and DHCP status, to name a few. Additionally, it also allows you to perform certain network-related operations on your computer, which come in handy during troubleshooting and make the process a lot more convenient. To get just the basic information about your network, simply run: ipconfig For a more detailed look into the network: ipconfig /all When you want to release an IP address used by an adapter: ipconfig /release To request a new IP address: ipconfig /renew For clearing the DNS resolver cache: ipconfig /flushdns

23. Tasklist

When you experience slowdowns on your computer, one of the likely explanations is the excessive consumption of resources by the processes running in the background. The tasklist command helps you in determining such processes right from the command window by listing down all the currently running processes on your system. For obtaining a list of all the processes on your system, run the following command: tasklist To display verbose task information: tasklist /v

24. Taskkill

Just as its name suggests, the taskkill command allows you to end running tasks (or processes) on your system. It’s kind of an extension of the tasklist command — responsible for listing all the currently running processes — that helps you end the processes running heavy on your system resources. So when there’s a need to kill a process, you simply need to run: taskkill /pid process_ID Eg: taskkill /pid 7018 To end a process along with its child processes: taskkill /pid process_ID /t For forcefully killing a process: taskkill /pid process_ID /f

25. Attrib

Attrib is an essential administrative utility that allows you to set or remove attributes assigned to the different files and folders on your computer to deny or grant access to them to other users on your PC. If you’ve got multiple users sharing the same PC, this can prove to be of great use in helping you manage what these users can access on the system. Before you add or remove attributes for a file/folder, first identify its attributes by running: attrib file_name Then, to add a new attribute, use the following syntax: attrib +r file_name_or_folder_name Eg: attrib +r MyFile …where +r sets the read-only attribute to the file/folder. Below are some other attributes you can use:

+h – to set the hidden file attribute +s – to set the system file attribute +a – to set the archive file attribute +v – to set the integrity file attribute +x – to set the scrub file attribute to limit background data usage

Use the attribute with the minus sign (–) to remove the attribute. You can also club multiple attributes together in a command to add or remove them from a file/folder.

Efficiently Performing Windows Operations With Command Prompt

Using the CMD commands above, you can perform most of the system operations on your Windows PC quickly and efficiently while saving yourself the extra steps you’d otherwise have to take if you followed the GUI approach. Of course, these are just some of the Command Prompt commands, and there’s a bunch of other complex commands, like installing programs using Winget, that you can use to carry out advanced operations. We feel the commands on this list will set the groundwork to get you familiar with the Command Prompt and its working to help you become proficient with it.

Essential Windows Command Prompt Commands You Need to Know - 32Essential Windows Command Prompt Commands You Need to Know - 42Essential Windows Command Prompt Commands You Need to Know - 67Essential Windows Command Prompt Commands You Need to Know - 93Essential Windows Command Prompt Commands You Need to Know - 89Essential Windows Command Prompt Commands You Need to Know - 17Essential Windows Command Prompt Commands You Need to Know - 42