Command Prompt, sometimes called the Command shell, is a legacy environment that dates back to the original version of Windows NT. But it is modeled after the Command.com command-line interpreter that Microsoft provided with MS-DOS, the text-based predecessor to Windows. As a result, it shares many commands with that earlier system too.
In MS-DOS and Command Prompt, scripts were originally called batch files. But a later scripting environment called Windows Script Host (WSH) provided access to more sophisticated automation capabilities.
Command Prompt is still provided in Windows for backward compatibility reasons, but Microsoft recommends that anyone needing automation capabilities today should focus on Windows PowerShell instead. While we agree with that advice, this chapter provides a few tips for using Command Prompt.
The Command Prompt can be easily found in Start. Unlike in previous Windows versions, it is no longer a separate standalone app but is instead a command-line profile that runs in the Terminal app.

The quickest way to launch Command Prompt is to open Start and type cmd.
Sometimes, you will need to run Command Prompt as an administrator. To do so, open Start, type cmd, and then right-click on Command Prompt in the search results list and choose “Run as administrator.”

Curiously, when you run Command Prompt as an administrator, it appears as a standalone app and not inside of Terminal.
Microsoft maintains a useful Command Prompt command reference that will help you get started with some old favorites like cd (change directory), dir (directory listing), format, mkdir (make directory), and ver (version). But you can also use Command Prompt to find a list of its available commands. To do so, open Terminal to a Command Prompt tab and type:
>help

The output from this command–the list of available commands–will scroll past the bottom of the console window, hiding much of it. To see the rest, you can scroll back up with the keyboard or mouse. Or you can type the following to cause the output to pause each time it has filled the height of the window:
>help | more
Hit any key to continue listing available commands.
In addition to the online command reference noted above, you can use the help command in Command Prompt to get help with an individual command. For example, to learn how to use the dir command, you would type:
>help dir

In this case, you don’t need to append | more to the end of the command, as help will automatically pause each time the text has filled the height of the window.
While you can use the cd command to navigate around the folder (directory) structures on your PC’s storage devices, it can get pretty tedious if the folders you need to get through have long names or names with spaces. But Microsoft makes this easier by supporting folder and file name auto-complete. For example, when you open Command Prompt, you’ll be placed in your profile folder (C:\Users\your-user-name). From here, you could navigate into the Desktop folder by typing:
>cd Desktop
But there’s an easier way. Instead, just type:
>cd d [and then hit TAB]
When you do, Desktop will auto-complete.
You can hit TAB multiple times, too, if there are multiple folders or files that start with the letter you typed. To get into the Downloads folder, you might type:
>cd d [followed by hitting TAB three times]
This will cycle through the Desktop, Documents, and then Downloads folders.
While most Windows functionality is exposed via graphic interfaces, there are still some useful and unique Command Prompt commands that are worth knowing about. Some of these include:
Fix corrupt system files. The System File Checker scans Windows and looks for any corrupted system files and, if needed, restores clean and working versions:
>sfc /scannow
System File Checker requires an elevated Command Prompt with administrator privileges.
Change the file extension for one or more files. To change the file extension for all files in the current directory from one extension (in this case, jfif) to another (in this case, jpg), you can use:
>ren *.jfif *.jpg
See the full Windows version number. You can see the version number of Windows, including the full build number, by typing:
>ver
Type winver instead to see the graphical version.
Get a detailed battery report. Windows will generate a report in the current directory that details the battery usage and estimates the battery life of portable PCs:
>powercfg /batteryreport
Display the password for a connected Wi-Fi network. Use the following command to display the password for the Wi-Fi network named SSID, being sure to replace SSID with the real name of that network. (You’ll find the password under Security settings > Key Content.)
>netsh wlan show profile SSID key=clear
With technology shaping our everyday lives, how could we not dig deeper?
Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.