How to use the Command Prompt in Windows 10

by Jon Martindale | Digital Trends

While yesteryear involved dependence on the Command Prompt for Windows users, these days, it’s less common. Still, understanding how to use Command Prompt—or CDM—can help you resolve performance issues and troubleshoot other PC problems.

We’ll cover the basics—from the shutdown shortcut to the Ping command to check connectivity—so you can navigate confidently. You’ll also learn how to use less common commands and some nifty tricks that will make you feel like an expert.

The most useful commands

You don’t need to know all of the Command Prompt commands to find some use in it. These are our favorites and some of the ones we consider the most useful.

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.

“command” /? – While it requires you 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 in this list. Good if you want more detailed information about what they do and to see examples of how they work.

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.

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 or your own personal remote server. Whatever you choose, if you get a response, you know a connection is there. Also useful for checking if local network systems are functioning properly.

Chkdsk – Full name Check Disk, “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 soon enough.

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

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.

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.

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.

Exit – 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.

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 take itself to bed.

Lesser-known, but still worthwhile

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.

Ipconfig /flushdns – An extension of the IPConfig command and useful when you’re running into bizarre network or connection issues, or changed 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.

Assoc – Used to view and change file associations — the type of file: .txt, .doc etc. — “Assoc” can be a useful command to know. Typing “assoc [.ext]” where ext is the file type in question, will tell you what it stands for. “.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. CommandWindows has a detailed guide on its more advanced functions.

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.

Telnet – Telnet is not commonly used for accessing modern devices remotely, but some can 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. Open Programs and Features by searching for it in the Windows search bar, or by going to the Control Panel > Programs > Programs and Features.

Once there, click “Turn Windows features on or off,” in the top left-hand corner.

Then tick the box next to Telnet Client and click the Ok button.

Once enabled, Telnet can let you access remote devices or servers, though bear in mind it is completely unencrypted (a hacker’s dream). Commands will be very situation specific, but will look something like “telnet 80” which would have you attempt to connect to 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.

| 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.

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.

A few additional tricks

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, or “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.

Driverquery – 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.

Change CMD color – If you don’t like the white text on black background coloring of the Command Prompt, you can change it to whatever you like. Simple right click the boundaries of the window, select “properties” and then navigate to the “colors” tab.

Compare files – If you have two files which are similar, but you’re not sure which is which or what differs, the file compare feature of the CMD may come in handy. To activate it, type “FC” followed by the two file name locations, including drive letter. An example might be: “fc C:UsersTestDesktoptest.txt C:UsersTestDesktoptest2.txt”.

Watch Star Wars – Yes, you read that right. You can actually watch the original Star Wars Episode IV: A New Hope (not everyone’s favorite) right within the Command Prompt. It’s in ASCII graphics but the entire movie is there if you know the right command trick. You’ll need to enable Telnet as explained in the above section of this guide, but once you have, paste in “telnet” and enjoy.

My Source