How to use the Command Prompt in Windows 10 and 11

The Command Prompt in Windows 10 and 11 isn’t the main tool it once was, but it’s still incredibly useful. With the right knowledge and experience, you can use command-line commands to perform a wide variety of tasks in Windows—many of which are not easily accomplished with a mouse. To help you find the tools you need to use the command line effectively, we’ve compiled a list of the most common and useful command line commands so you can get it working exactly the way you want it to.

How to access the command line in Windows

Jon Martindale / DigitalTrends

There are many different ways to access the command line, but there are two methods that are the simplest:

  • Search for “Command Prompt” using Windows Search, then select the appropriate result.
  • Press Windows key + R open Jogging terminal. Then type “CMD” and press input key.

Some commands won’t run in the command prompt without proper permissions, so if you’re having trouble, try right-clicking the CMD icon and choosing Run as administrator instead of that.

How to use the command line

If you’re used to a visual interface like Windows or macOS, then the command line might seem like something from ancient history — and it is. Command Prompt was first added to Windows predecessors nearly 40 years ago, but it’s still as functional today as it ever was.

To use it, you will need to type commands in a specific order with correct spaces and special characters. If you’ve ever done any programming, it will look a little familiar. Enter the command with correct spelling, syntax, and context, and you’ll get the result you want. If you don’t do it all right, it won’t do anything except let you know you did something wrong.

However, follow the proper instructions on how to use the various command line commands and you should be fine.

Most useful commands

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

Help — Probably the most important of all command line commands, typing “help” will bring up a list of available commands. If you learn nothing else from this guide, know that “help” is only four short letters away if you ever fall down the CMD rabbit hole.

“command” /? — Although it requires entering the command in the quoted section (without quotes), this one will tell you everything you need to know about any of the commands in this list. It’s great to use if you want more detailed information about what the commands do and see examples of how they work.

TRACERT — If you want to track your computer’s Internet traffic, this command allows you to track the number of intermediate servers your packets go through, the time it takes for each transfer, and the name or IP address of each server.

See also  How to Enable Automatic Mail Forwarding in Yahoo?

IPConfig — If you’re having networking issues, IPConfig will be very useful for a variety of reasons. Running it tells you a lot about your computer and your local network, including the IP address of your router, the system you’re running at the time, and the state of your various network connections.

Ping — Need to confirm if your internet is officially down or if a software issue is causing the problem? Ping something. It doesn’t matter if it’s or your personal remote server. Whatever you choose, if you get a response, you know there’s a connection. This command is also useful for verifying that local network systems are working properly.

Running the ping command at the Windows command line.Image used with permission of the copyright holder

Chkdsk — Check Disk, written as “Chkdsk”, looks for errors on the selected drive. While there are many Windows and third-party tools to check drives for errors, Check Disk is a classic that works well and could save you from data loss if it finds the problem early enough.

SFC — Short for System File Checker, the “SFC /scannow” command will scan all Windows system files for errors and repair them if it can. Warning: this may take some time.

Cls — The results of command line commands can be useful, but they are not the best organized or easy to read. If the screen is too full, just type “Cls” and press enter to clear it.

Dir — If you are using the command line to browse your file system, the “Dir” command will list all files and folders within the current folder. You can also add /S and use it as a search when you want to find something specific.

Running DIR Command in Windows Command Prompt in Windows 10.Image used with permission of the copyright holder

Netstat — This command displays all kinds of information about existing connections to your computer, including TCP connections, the ports your system is listening on, Ethernet statistics, and the IPRouting table.

Output — does exactly what you’d expect. Don’t want to reach for the mouse or can’t press that “X” in the upper right corner? Just type “exit” and press enter to exit the command line.

Task List — The Task List provides current information about all the tasks that Windows is currently running. You can add switches (such as “-m”) to learn more details about these tasks and how they work, which is very useful for diagnosing potential problems. Not surprisingly, this is often followed by the “Taskkill” command, which is used to force certain tasks to end.

Shutting down — While you don’t necessarily need to shut down your Windows 10 or 11 computer at night, you can do so through the command line and the Start menu. Just type “shutdown” and hit enter, and your computer will shut itself down.

See also  Everything You Should Know About The Upcoming Dota 2 The International 2023

Lesser known but still valuable commands

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

Ipconfig /flushdns — This is an extension of the IPConfig command and is useful when you encounter bizarre network or connection problems or change DNS servers. This one will often solve the problems you have. This clears the Windows cache of DNS details, meaning Windows will start using your preferred option instead.

Assoc — This command is used to view and change file associations, meaning the file type, such as .txt, .doc, etc. By typing “assoc [.ext]” — where ext is the file type in question — will tell you what that means, and “.txt” will tell you 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 treated as text files.

Note: This is a powerful command and should be used with caution. CommandWindows has a detailed guide on its more advanced functions.

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

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

Deltree — Deltree is used to locate a specific file or directory path and delete it completely, removing everything that was in that location. This command can be dangerous for newcomers, so use it with caution, but it is useful for users who want to get rid of data quickly.

Telnet — Telnet is not typically used for remote access to modern devices, but some still require setup via Terminal Network Protocol (Telnet). It’s not activated in Windows 10 or 11 by default, so you’ll need to turn it on to use it. Start by going to the Windows search bar at the bottom of your screen and typing “Telnet”. Windows is smart enough to suggest the right location. choose Turn Windows features on or off open the window.

Scroll down until you find it Telnet client. Things are more or less in alphabetical order, which can help you find it. When you see it, make sure the box next to it is checked, then select it Alright. Windows will search for the necessary files and enable the software, then notify you that you must restart to complete the changes. Do it and start again!

See also  How to buy Microsoft Office: all methods, explained

Enabling Telnet commands from within the command line.Image used with permission of the copyright holder

Once enabled, Telnet can allow you to access remote devices or servers, although note that it is completely unencrypted (a hacker’s dream). The commands will be very situation specific, but will look something like “telnet 80”, which means you are trying to connect to on port 80. It won’t work, but this is what a typical command might look like.

& — This command will allow you to run two commands at once. All you have to do is put an “&” between them and both will be executed at the same time.

| clip — placing this command after the original command will copy the output directly to the clipboard. Let’s say you want to copy your IPConfig information — all you need to do is type “ipconfig | clip” and the results will be added to your clipboard, so you can paste them wherever you want.

You can also copy and paste in a similar way 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 line will spit out the IP address.

A few extra tricks

Although the commands above are most useful when using the command line, there is more you can do. In learning how to use the command line, it’s also good to remember these handy tricks.

Function Keys — Although not used as often in modern software, the function keys (F) can do a lot in a command line setting:

  • F1 allows you to paste your last command, character by character.
  • F2 pastes the last command only at the specified character.
  • F3 glues it entirely.
  • F4 deletes the command up to the specified character.
  • F5 pastes the last used command without a cycle.
  • F6 pastes “^Z”.
  • F7 gives you a list of previously used commands.
  • F8 pastes used commands that can be changed.
  • F9 allows you to paste a command from the recently used list.

Driverquery — If you ever want to see a comprehensive list of all the drivers currently running on your computer, typing “driverquery” at the command line is a great way to do it.

Change CMD color – If you’re not a fan of classic white text on a black background, you can change the color scheme of the command line with a few clicks. Click on the window border and the Properties menu will appear. Select the Colors tab and change the colors to what you want.

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

Editor’s recommendations

Categories: How to

Rate this post

Leave a Comment