Tech

Latest In

Tech

How to Use the Command Prompt in Windows 10

This article explains how to use the Command Prompt in Windows 10. Command Prompt is a command line interpreter.

Daniel Barrett
Jul 31, 20223352 Shares372438 Views
Command Prompt is a command line interpreter application available in most Windows operating systems. It’s used to execute entered commands. Most of those commands automate tasks via scripts and batch files, perform advanced administrative functions, and troubleshoot or resolve certain kinds of Windows issues.
Command Prompt is formally termed “Windows Command Processor”, but it’s also sometimes referred to as ​the command shell or cmd prompt, or even by its filename, cmd.exe.
It’s sometimes erroneously referred to as “the DOS prompt” or as MS-DOS itself. Command Prompt is a Windows program that emulates many of the command line abilities available in MS-DOS, but it’s not MS-DOS.
Not to be confused with, Cmd is also an acronym for many other technical terms like centralized message distribution, color monitor display, and common management database, but none of them have anything to do with Command Prompt.

How to Access the Command Prompt

There are quite a few ways to open Command Prompt, but the “normal” method is via the Command Prompt shortcut located in the Start menu or on the Apps screen, depending on your version of Windows.

How to Use the Command Prompt

Screenshot-2021-04-15-160634.jpg
Screenshot-2021-04-15-160634.jpg
To use Command Prompt, you enter a valid Command Prompt command along with any optional parameters. Command Prompt then executes the command as entered and performs the task or function it’s designed to perform in Windows.
For example, executing the following Command Prompt command in your Downloads folder would remove all MP3s from that folder:
Commands must be entered into Command Prompt exactly. The wrong syntax or a misspelling could cause the command to fail or worse; it could execute the wrong command or the right command in the wrong way. A comfort level with reading command syntax is recommended.
For example, executing the dir command will show a list of files and folders that exist at any specific location on the computer, but it doesn’t actually do anything. However, change just a couple letters and it turns into the del command, which is how you delete files from Command Prompt!
Grammar is so important that with some commands, especially the delete command, adding even a single space can mean deleting entirely different data.
Here’s an example where the space in the command breaks the line into two sections, essentially creating two commands where the files in the root folder (files) are deleted instead of the files in the subfolder (music):
del C:\files\ music
The proper way to execute that command so as to remove files from the music folder instead is to remove the space so that the whole command is strung together correctly. Don’t let this dissuade you from using Command Prompt commands, but definitely let it make you extra careful.
Also read:How To Update Your Computer’s BIOS

Some Common Command Prompt Commands

A large number of commands exist in Command Prompt, but their availability differs from operating systemto operating system.
Here are some of the more commonly used Command Prompt commands that are utilized in a variety of circumstances;

1. Help

Arguably the most important of all Command Prompt commands, typing “help” will give you a list of available commands. If you don’t learn anything else from this guide, know that “help” is only four short letters away if you ever fall down a CMD rabbit hole.
Screenshot-2021-04-15-160844.jpg
Screenshot-2021-04-15-160844.jpg

2. “command” /?

While it requires you to input a command in the quoted section (without the quote marks), this one will tell you everything you need to know about any of the commands on this list. It’s great to use if you want more detailed information about what the commands do and to see examples of how they work.

3. TRACERT

Should you want to track your PC’s internet traffic, this command lets you track the number of intermediate servers your packets go through, the time each transfer requires, and the name or IP address of each server.

4. IPConfig

If you have networking issues, IPConfig will be very useful for all sorts of reasons. Running it tells you a lot about your PC and your local network, including the IP address of your router, the system you’re using at the time, and what the state of your various network connections are.

5. Ping

Need to confirm whether your internet is officially down or if there’s just some software problem causing an issue? Ping something. It doesn’t matter whether it’s Google.com or your own personal remote server. Whatever you choose, if you get a response, you know a connection is there. This command is also useful for checking if local network systems are functioning properly.

6. Chkdsk

Check Disk, written as “Chkdsk,” looks at your chosen drive for errors. Although there are plenty of Windows and third-party tools for checking a drive for errors, Check Disk is a classic that works well and could save you from losing data if it finds a problem early enough.

7. SFC

Short for System File Checker, the command “SFC /scannow” will scan through all of the Windows system files to look for any errors and repair them if it can. Warning: This one can take some time.

8. Cls

Command Prompt command results might be useful, but they aren’t the most well organized or easy to read. If the screen is getting too full, just type “Cls” and hit enter to clear it.

9.Dir

If you’re using the Command Prompt to browse your file system, the “Dir” command will display all of the files and folders within the current folder. You can also add an /S and use it as a search when you want to find something specific.

10. Netstat

This command displays all sorts of information about existing connections to your PC, including TCP connections, ports on which your system is listening, Ethernet statistics, and the IPRouting table.

11. Exit

This does exactly what you would expect it to do. Don’t want to reach for the mouse or can’t seem to click that “X” in the top-right corner? Just type “exit” and hit enter to leave the Command Prompt behind.

12. Tasklist

Tasklist gives you immediate data on all the tasks that Windows is currently operating. You can add switches (such as “-m”) to dig down into more detail about these tasks and how they work, which is very useful for diagnosing any potential problems. It’s no surprise, then, that this is often followed up by the “Taskkill” command, which is used to force specific tasks to end.

13. Shutdown

Although you don’t necessarily need to shut down your Windows 10 PC at night, you can do it through the Command Prompt as well as the Start Menu. Just type “shutdown” and hit enter, and your PC will put itself to bed.

Uncommon yet Useful Commands

Not all of the Command Prompt commands are ones you’ll need to use regularly, but that doesn’t mean there aren’t some handy functions among the less common ones. These are some of our favorites that often fly under the radar.

1. Ipconfig /flushdns

This is an extension of the IPConfig command, and it’s useful when you’re running into bizarre network or connection issues or change your DNS server. This one will often clear up any problems you have. This clears the Windows cache of DNS details, meaning that Windows will start using your preferred option instead.

2. Assoc

This command is used to view and change file associations, meaning the type of file, like .txt, .doc, etc. Typing “assoc [.ext]” — where ext is the file type in question — will tell you what it stands for, and “.txt” will tell you that it’s a text file. If you want to change that, you can type something like “assoc .log=txtfile” and all .log files will then be considered text files.
Note: This is a powerful command and should be used with caution.

3. Cipher

Cipher can be used to view and alter encryption information for your system’s files and folders. Depending on the additional parameters applied, you can have it encrypt files to protect them from prying eyes, create brand new encryption keys, and search for existing encrypted files. For the full list of parameters, Microsoft’s breakdown is comprehensive.

4. Finger

Finger is used to collect information about users on the computer or a connected remote computer. It’s often used to see what a specific user is doing or where they are, digitally speaking. It can be used with a specific computer or an IP address.

5. Deltree

Deltree is used to specify a particular file or directory path and delete it entirely, removing everything that used to be at that location. This can be a dangerous command for newcomers to use, so do so with caution, but it’s useful for users who want to get rid of data quickly.

6. Telnet

Telnet is not commonly used for accessing modern devices remotely, but some still require setup through the Terminal Network (Telnet) protocol. It’s not activated in Windows 10 by default, so to use it, you’ll need to turn it on. Start by going to the Windows 10 search bar at the bottom of the screen and typing in “Telnet.” Windows 10 is smart enough to suggest the right location. Select Turn Windows Features On or Off to open the window.
Scroll down until you find Telnet Client. Things are more or less in alphabetical order, which can help you find it. When you see it, make sure the box beside it is checked, then select OK. Windows will search for the necessary files and enable the software, then let you know you need to reboot to complete the changes. Do this and start back up!
Once enabled, Telnet can let you access remote devices or servers, though bear in mind it is completely unencrypted. Commands will be very situation-specific but will look something like “telnet Novabach.com 80,” which would have you attempt to connect to Novabach.com on the 80 port. It won’t work, but that’s what a typical command might look like. This command will let you run two commands at once. All you need do is put “&” between them, and both will execute at the same time.

7. | clip

Putting this command after your original command will copy the output directly to your clipboard. Say you want to copy down your IPConfig information — all you’d need to input is “ipconfig | clip” and the results will be added to your clipboard, so you can paste them anywhere you like.
You can also copy and paste in a similar manner to the main Windows interface.

8. Nslookup

Want to find the IP address of any website? This command will do it for you. Simply type “nslookup” followed by the URL in question, and the Command Prompt will spit out an IP address.

9. Driver Query

Although this is a command, it’s not likely to be one that many use. However, should you ever wish to see a comprehensive list of all of the drivers currently operating on your PC, typing “driverquery” into the Command Prompt is a great way to do it.

10. Change CMD color

You can get creative here if you want. If you’re not a fan of the classic white text on the black background, you can change the Command Prompt’s color scheme with a few clicks. Click on the window’s border, and a Properties menu will appear. Select the Colors tab and change the colors to whatever you want.

10. Compare files

You can conveniently compare a list of differences between similar versions of a file using a simple shortcut through CMD’s Compare File feature. To give it a try, type “FC,” the two filename locations, and the drive letter. It could look like this: “fc C:UsersTestDesktoptest.txt C:UsersTestDesktoptest2.txt”.

A few Additional Features

Although the above commands are the most useful when using the Command Prompt, there’s more you can do. In learning how to use the Command Prompt, it’s good to also take note of these handy tricks.

Function keys

Although not so commonly used in modern software, the Function (F) keys can do quite a lot in a Command Prompt setting:
  • F1 lets you paste in your last command, character by character.
  • F2 pastes the last command only to a specified character.
  • F3 pastes it entirely.
  • F4 deletes a command up to a specified character.
  • F5 pastes the last used command without cycling.
  • F6 Pastes “^Z”.
  • F7 gives you a list of previously-used commands.
  • F8 pastes cyclable used commands.
  • F9 lets you paste a command from the list of recently used ones.

Command Prompt Availability

Command Prompt is available on every Windows NT-based operating system which includes Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, and Windows 2000, as well as Windows Server 2012, 2008, and 2003.
Windows PowerShell, an advanced command line interpreter available in recent Windows versions, supplements the command executing abilities available in Command Prompt. Windows PowerShell may eventually replace the Command Prompt in a future version of Windows.

Conclusion

This article is written to be strictly followed with precision. One should be extremely careful when using command prompts due to it’s technicality. We hope you get to master it properly and use it efficiently.
Editor’s picks:
Jump to
Latest Articles
Popular Articles