Skip to main content

How to use the Command Prompt in Windows 10 and 11

The Command Prompt in Windows 10 and 11 isn’t the mainstay tool it once was, but it’s still incredibly useful. With the right know-how, you can use Command Prompt commands to perform a wide range of tasks in Windows — and many of them aren’t easy to do with a mouse. To help you find the tools you need to use the Command Prompt effectively, we’ve put together a list of the most common and useful Command Prompt commands so you can get it working exactly how you want to.

How to access Command Prompt in Windows

Searching for Command Prompt in Windows 11.
Jon Martindale / DigitalTrends

There are a lot of different ways to access the Command Prompt, but there are two methods that are the most straightforward:

  • Use Windows search to look for “Command Prompt,” then select the corresponding result.
  • Press Windows Key R to open the Run terminal. Then type “CMD” and press the Enter key.

Some commands won’t run in Command Prompt without the appropriate permissions, so if you run into difficulty, try right-clicking on the CMD icon and selecting Run as Administrator instead.

How to use Command Prompt

If you’re used to a visual interface like Windows or macOS, then Command Prompt might look like something out of ancient history — And it is. The Command Prompt was first added to the predecessors of Windows almost 40 years ago, but it is still just as functional today as it ever was.

To use it, you’ll need to type out commands in a specific order with correct spacing and special character usage. If you’ve ever done any programming, it’ll feel a little familiar. You input the command with correct spelling, syntax, and context, and you’ll get the result you want. If you don’t do all that right, it won’t do anything but let you know you did something wrong.

Follow proper instructions on how to use various Command Prompt commands, though, and you should be OK.

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

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.

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 the state of your various network connections.

Ping — Need to confirm whether your internet is officially down or if a software problem is 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.

Running a ping command in the Windows Command Prompt.
Image used with permission by copyright holder

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.

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.

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

Running the DIR command in a Command Prompt Windows in Windows 10.
Image used with permission by copyright holder

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

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 that this is often followed up by the “Taskkill” command, which is used to force specific tasks to end.

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

Lesser-known but still worthwhile 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.

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.

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

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.

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.

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 or 11 by default, so to use it, you’ll need to turn it on. Start by going to the Windows search bar at the bottom of the screen and typing in “Telnet.” Windows 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!

Enabling Telnet commands within the Command Prompt.
Image used with permission by copyright holder

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 DigitalTrends.com 80,” which would have you attempt to connect to DigitalTrends.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.

| 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 also good to note 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.

Driverquery — If you ever wish to see a comprehensive list of all 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’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.

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

Editors' Recommendations

Jon Martindale
Jon Martindale is the Evergreen Coordinator for Computing, overseeing a team of writers addressing all the latest how to…
Microsoft announces a new threat to push people to Windows 11
Windows 11 and Windows 10 operating system logos are displayed on laptop screens.

Microsoft is sharing more details of its plans to transition customers still using Windows 10 from a free offering to a paid structure if they wish to continue receiving security updates.

The company is phasing out the legacy operating system, which will reach its end-of-life support on October 14, 2025. After this, Microsoft will begin charging enterprise users a monthly fee for Extended Security Updates (ESU). Businesses must purchase an ESU license for all Windows 10 devices in order to maintain security support beyond the cutoff date.

Read more
How to adjust screen resolution in Windows 11 and older
microsoft surface laptop go review featured image

You're not actually stuck with the screen resolution setting your Windows PC came with. In addition to tons of other device personalization options, screen resolutions are customizable on Windows PCs. And adjusting the screen resolution on your Windows machine is easier than you think. All it takes is a quick trip to your Settings app or Control Panel (depending on which version of Windows you're running) and a few clicks and you're on your way to an easier-to-view screen. Here, we'll show you how to adjust screen resolutions for Windows 11, Windows 10, and Windows 7 PCs.
In Windows 11
Step 1: Navigate to the Windows 11 Settings app.

Step 2: Click Display.

Read more
How to uninstall Windows 11 and rollback to Windows 10
A man sits, using a laptop running the Windows 11 operating system.

Change is a constant in the world of technology, and operating systems are no exception. Windows 11, with its sleek interface and improved features, may have tempted you into upgrading to Windows 11. Yet, as with any change, there can be a multitude of reasons why you might want to revert to your previous OS or explore alternative options. In this guide, we'll explain how to uninstall Windows 11.

Whether you're facing compatibility issues, prefer the familiarity of an earlier Windows version, or simply feel that what was once the best desktop you've ever had has become the worst, we've got you covered.

Read more