I want to impress my hacker friends by learning how to use the Command Prompt window in Windows 10. What are the most basic commands I should know to get started?
I like it. Old school Windows, as if we were back in the glorious 1980’s and the command line was the only game in town! You really want to go with a Linux command shell in Windows but the basic MS-DOS style window can work too in a pinch, and the good news is that it’s ready to go on every Windows computer ever made. The down side is that it’s extremely limited in its functionality and barely offers more than a few administrative commands and a very rudimentary ability to move around the file system and list files.
Still, it is pretty interesting to have a sort of digital journey down memory lane with the command line interface in Windows, so let’s have a look. Keep in mind that any time you’re working at the command prompt you’re also generally working without a safety net, so don’t remove files or rename anything unless you’re entirely sure you know what you’re doing. Be careful!
With that understood, let’s start with a File Explorer view of the C:\WINDOWS directory:
Notice that File Explorer has neatly shown this directory as This PC > Local Disk (C:) > Windows but as you can see, it’s a lot of folders full of content. So what’s it look like from the Command Prompt?
To find out, search for “command” in Windows 10 search:
Notice that there are more options than usual below the Command Prompt app. Specifically, there’s “Open” and “Run as administrator”. For basic interaction and command line usage you definitely want to run as a regular non-administrative user by choosing “Open“. In a little bit I’ll show you a very useful command that requires you to be administrator, so in that instance you’ll want to fire up a new Command Prompt using the “Run as administrator” link.
For now, just click or tap on “Open“. Now I can demonstrate two very useful commands: CD to change directory and DIR to list files and folders within a directory:
You’ll have to look closely, but the first command typed in is CD \WINDOWS to get to the same location as the File Explorer view, then DIR /W to produce a listing of files and folders in a handy multi-column view.
Look closely at it, though, and you’ll realize that the sorting order for this multi-column view is pretty confusing because we naturally read columns top to bottom, left to right, but it’s sorted top left to bottom right. Fortunately there’s a solution for that. Instead of using DIR /W try DIR /D instead:
Much better. See? You’re already becoming a Command Prompt power user! 🙂
One more DIR command: This time we’re going to add multiple command flags or options: /N /Q and /P for a combined command of DIR /N /Q /P. It offers this view:
The command flags let you really fine tune the results you get: /N produces a long listing format, /Q includes the owner of each file and folder and /P pauses the listing on a page-by-page basis (notice the last line prompts “Press any key to continue…“).
In fact, you can learn more about the DIR command by using DIR /?
Another useful command to know: DEL lets you delete a file, as in DEL TESTFILE.TXT but be aware that there’s no recycle bin so deletes are instantly permanent. Obviously, use this with care!
FIND is a useful command too as it can search the contents of files in a folder or even subfolders. Learn more with FIND /?
Finally, if you want to show off some admin skills too, go back to the original search results from your search for “command” and choose “Run as administrator”. This is a more powerful command prompt so it’s commensurately more dangerous if you accidentally use DEL or similar. But instead there’s an administrative disk repair command called SFC that’s helpful to run sporadically. Add the /SCANNOW flag to force it to work immediately too:
It takes a few minutes to grind through your disk ensuring it’s all formatted and set properly. After a minute or two you’ll finally get the results of the SFC file check:
Interestingly, it did find there was something corrupted and fixed it. Handy!
That’s a good intro to the Command Prompt. When you’re done, either type EXIT to close down the app or just click on the “X” on the top right to close the window. Be careful and have fun!
Want to graduate to the more powerful Linux powershell? Here’s a tech note on how to get that running on your Win10 system: How to Install the Windows Subsystem for Linux on Windows 10.
Pro Tip: I’ve been writing about Windows and Linux for quite a while. Please check out my Windows help and Linux help both while you’re here on the site!