The Windows Command Prompt is a feature that has long been a core part of the Windows operating system. There are some CMD commands that are so useful and easy to use that even ordinary users see the Windows command line as a key part of the operating system.
There are always rumors that it will be discontinued at some point, but this is unlikely to happen anytime soon.
Below are the 21 best CMD commands you should know if you want to have more control over your Windows PC.
[youtube https://www.youtube.com/watch?v=e9QMbPMp39A?feature=oembed]
1. ASSOC: Fix file associations
One of the most powerful tools in the CMD command library is the ASSOC command.
Your computer associates certain file extensions with certain programs. This is how your computer knows to open Adobe when you double-click a PDF file, or Microsoft Word when you double-click a DOC file.
You can view all the file associations your computer knows about by typing ASSOC in the command window. You will see the file extension and the program it is associated with.
– /
You can establish a link by typing something like assoc .doc = Word.Document. 8.
2. FC: Compare file
Sometimes, when files change over time, it’s hard to remember what the difference is between versions. You may not know that the CMD command allows you to compare files and see all the differences, but it’s true.
The FC command compares ascii files or binaries and lists any differences found.
Fc / a File1.txt File2.txt compares two ascii files.
Fc / b Picture1.jpg Picture2.jpg will perform a binary comparison of the two images.
3. IPCONFIG: IP Configuration
Network troubleshooting is never easy, but one command that makes it much easier is IPCONFIG.
Using this command on the CMD command line returns detailed information about your current network adapter connection, including:
- Current IP address
- Subnet mask
- Default Gateway IP
- Current Domain
This information can help you troubleshoot router issues and other connection problems that may occur with your network adapter.
4. NETSTAT: Network Statistics
Worried that your computer might be running malware that connects to the Internet without you knowing about it?
If you run the NETSTAT command on the command line, you can get a list of all active TCP connections from your computer.
5. PING: Send test packets
An IT analyst’s best friend is the PING team. Running this command sends test packets over the network to the target system.
You can use the PING command to check if your computer can access another computer, server, or even a website. This can help detect network outages. It also shows packet transit times in milliseconds, so it also detects bad network connections.
6. TRACERT: Trace the path
TRACERT is a fun Windows command to use. If you ever want to know which path your internet traffic takes from your browser to a remote system like Google’s servers, you can use TRACERT to see this.
The command stands for “Trace Route” which sends packets to a remote destination (server or website) and gives you all of the following information:
- Number of hops (intermediate servers) before getting there to the destination.
- The time it takes to get to each crossing.
- The IP, and sometimes the name of each hop.
TRACERT can show how the routes of your Internet requests change depending on where you access the Internet. It also helps when troubleshooting a router or turning on a LAN, which can be problematic.
7. POWERCFG: Power configuration
Are you frustrated with how quickly your laptop runs out of power? Your power settings may be configured as efficiently as possible. A Windows CMD command called POWERCFG (Power Configuration) can help with this. Run Command Prompt as Administrator and enter powercfg – energy to get a complete energy efficiency report.
The process can take up to a minute, but when it is complete, you will see if there are any warnings or errors that can help you improve the energy efficiency of your system.
Review the energy-report.html file for detailed information on these errors and warnings.
8. Shutdown: Turn off the computer
The SHUTDOWN command is a fairly versatile command that allows you to shutdown your computer, but control the shutdown behavior. It is typically used as a scheduled task or as part of an IT batch job after a computer system is patched.
Typing shutdown / i from the command line will initiate a shutdown, but the GUI will prompt the user to restart or shut down completely. If you don’t want the pop-up GUI to appear, you can simply enter the shutdown / s command.
There is a long list of other options that can be used to log off, hibernate, restart, and more. Just type shutdown with no arguments to see them all.
9. SYSTEMINFO: System information
If you need to know what network card you have, processor information, or the exact version of your Windows OS, the SYSTEMINFO command can help.
This command queries your system and retrieves the most important information about it. It presents information in a clear and easy-to-read format.
10. SFC: System File Checker
If you’ve ever worried that a virus or other software might damage your essential system files, there is a Windows command that can scan these files and ensure their integrity.
You need to run CMD as administrator (right click and select “Run as administrator”). Entering SFC / SCANNOW will check the integrity of all protected system files. If a problem is found, the files will be restored using the system file backups.
The SFC command also allows you to:
- / VERIFYONLY: check integrity, but not restore files.
- / SCANFILE: check the integrity of specific files and repair if damaged.
- / VERIFYFILE: check the integrity of certain files, but do not restore them.
- / OFFBOOTDIR: Use this to restore the offline boot directory.
- / OFFWINDIR: Use this to restore an offline Windows directory.
- / OFFLOGFILE: Specify the path to save the log file with scan results.
The scan can take 10 to 15 minutes, so give it time.
11. NET USE: Map Drives
If you want to map a new drive, you can always open File Explorer, right-click “This PC” and go through the Map Network Drive Wizard. However, with the NET USE command, you can do the same with a single command line.
For example, if you have a shared folder on a computer on your network called \ OTHER-COMPUTER SHARE , you can map it as your own Z: drive by typing the command:
Net use of Z: “\ OTHER-COMPUTER SHARE” / persistent: yes
A permanent switch tells your computer that you want to remap this drive every time you log on again.
12. CHKDSK: Check Disk
Although the SFC command only checks the integrity of the core system files, you can use the CHKDSK command to scan the entire disk.
To check the C: drive and fix any problems, launch a command window as administrator and type CHKDSK / f C:.
This command checks for things like:
- File fragmentation
- Disk errors
- Bad sectors
The team can fix any disk errors (if possible). When the command is complete, you will see the status of the scan and the actions taken.
13. SCHTASKS: Schedule tasks
Windows comes with a wizard for creating scheduled tasks. For example, perhaps you have a BAT file stored at C: temp that you want to run every day at noon.
To set this up, you will need to click the Schedule Wizard. Or you can enter one SCHTASKS command to configure it.
SCHTASKS / Create / SC HOURLY / MO 12 / TR Example / TN c: temp File1.bat
The scheduled switch accepts arguments such as minute, hour, day, and month. Then you specify the frequency with the / MO command.
If you entered the command correctly, you will see the response “SUCCESS: The sample scheduled task has been successfully created.”
14. ATTRIB: Change file attributes
On Windows, you can change the attributes of a file by right-clicking the file and choosing the property you want. However, instead of looking for a file attribute, you can use the ATTRIB command to set the file attributes.
For example, if you type: ATTRIB + R + H C: temp File1.bat, it will set File1.bat as a hidden read-only file.
If successful, there is no response, so if you don’t see the error message, the command worked.
Other Windows CMD commands
As you can see, there are several powerful and useful things that you can do using the Windows Command Prompt if you know the correct commands.
Believe it or not, there are even more commands that will give you the ability to do some things that you probably never realized just by typing a simple command.
- BITSADMIN: Initiate uploads or downloads of jobs over the network or the Internet, and monitor the current transfer status of these files.
- COLOR: Change the background color of the Command Prompt window.
- COMP: Compare the contents of any two files to see the differences.
- FIND / FINDSTR: Search for strings within any ASCII files.
- PROMPT: Change the command line from C: to something else.
- TITLE: Change the title of the Command Prompt window.
- REGEDIT: Change keys in the Windows registry (use with caution).
- ROBOCOPY: A powerful file copy utility built right into Windows.
If you want to know more, Microsoft offers a complete list of all Windows CMD commands included in the latest version of Windows.
–
Comments on “21 CMD Commands All Windows Users Should Know”