SSL CERTIFICATE.

Windows Command Prompt – The Ultimate 2023 Edition

Windows command prompt

 

The Windows Command Prompt is largely ignored by users these days since the graphical interface can accomplish almost anything. It’s simpler, isn’t it? So why does Windows still have a prompt?

It is still relevant even though it is nearly 50 years old. Instead, it’s highly well-liked and highly helpful to many. Being enduring over time is enough justification to become acquainted with it. Even in this day and age, it remains the best method for completing many tasks. It’s also fairly simple to use.

Alright, let’s get started! We’ll walk you through how to use the Windows prompt command line, go over the fundamentals of the command prompt Window, and provide you with a detailed reference of the most frequently used CMD commands.

What Is Windows Command Line?

An operating system (OS) or program’s text-based user interface (UI) that allows you to carry out different tasks is called a command prompt or prompt. You can, for example, use your computer to interact with it, manage files and directories, execute programs, script, automate, and carry out other simple and complex tasks.

Certain operating systems only give you a CLI, but others may give you both a CLI and a GUI.

Under Microsoft Windows, OS/2, eComStation, ArcaOS, and ReactOS, the default command-line interpreter is the Command Prompt, also known as cmd.exe. Better put, it runs the commands you enter into the Windows operating system, much like Shell does on Unix-based systems and Terminal does on macOS.

Shells, or programmes that let you give commands to a computer, are what both CLIs and GUIs are. But a CLI isn’t the same as a GUI because a GUI lets you use graphical elements—like menus and icons—instead of text to interact with the system.

History of CMD Commands.

Text-based commands date back to the days of Windows Personal Computers. Early Windows operating systems lacked a mouse cursor and other GUI components, and users could only interact with them via CLIs.

Question: What is the date on which the CMD commands were made accessible?

Answer: In December 1987, the Windows Prompt was made available. Since then, Microsoft’s design has essentially remained the same. However, in Windows 10, 8, 7, Vista, and XP, we formally recognize them as CMD commands.

The commands were referred to as DOS commands in previous iterations, such as Windows 98/95. Clients used the MS-DOS Prompt to run commands, and Windows versions up until the 2000s integrated MS-DOS. Later, in 2001, it was renamed Command Prompt, beginning with Windows XP.

Why Would You Use The Command Prompt?

Because of how obsolete text commands are in today’s streamlined operating systems, many users haven’t even touched the Windows Command Prompt. Indeed, if you are accustomed to the graphical user interface (GUI), you may find it inconvenient to carry out certain tasks, like managing files and folders via the command line.

Nevertheless, the command line comes in very useful for a lot of things, like finding your IP address. Furthermore, even though it functions on a fundamental level, the CMD is actually the more potent option.

It reduces the amount of time needed to complete a new task by condensing dozens of GUI clicks into a single line. Power users also like it because it allows them to communicate directly and gives them more control over their computers.

You can carry out complex operations with the command window, like making taskbar-pinning shortcuts, gaining access to important data, handling security concerns, and troubleshooting Windows errors. Additionally, you have access to portions of the operating system that the graphical user interface does not provide.

Finally, not only does this list of commands work with Windows, but it also works with Linux, macOS, and a host of other operating systems. Therefore, even if you move to a different OS in the future, having learned them once might still be useful.

How To Open the Windows Command Line?

There are several ways to launch the Command Prompt in Windows:

    • Start Menu > Type “Command Prompt” > Press Enter

A screenshot from Windows PC displaying how to open the command prompt from the start menu.

    • Start Menu > Type “CMD” > Press Enter

A screenshot from Windows PC displaying how to open the command window from the start menu.

    • Press Win + R > Type “CMD” > Press Enter

A screenshot displaying how to open ports from the Run command dialog box on a Windows.

    • Right-click the Start Menu > Choose Command Prompt
    • Press Win + X > Choose Command Prompt

Depending on your Windows settings, the Command Prompt in the Start Menu may also show up as Windows PowerShell or Windows Terminal. Both are compatible with CMD commands and have greater power.

A screenshot of the Start Menu on a Windows, displaying the PowerShell option and clipboard-related topics.

However, keep in mind that some commands call for administrator privileges. Make sure you select the Admin option from the menu in order to run some of the commands and open a command prompt. Holding down Ctrl + Shift during launch will grant you administrator permissions for the other CMD opening methods.

How To Use the Windows Command Line?

You’ll discover a lot as soon as you launch the command prompt.

Your Windows version is displayed in the first line. That’s 10.0.19045.2486 in my instance. Additionally, take note of the third line, which reads C:Users[Username]>. If CMD depends on location, it relates to the Windows user and indicates the location of where your commands will be executed. On the other hand, some CMD commands are generic. So it won’t matter where you are.

A screenshot as an example of the command window.

Question: In CMD, how many commands are there?

Answer: You can use about 100 commands, though the precise number varies based on your Windows version.

The instructions do not depend on the case. However, make sure you type the command in correctly as you are issuing it directly to them. The system won’t be able to comprehend you if not. But fear not—a typo cannot really hurt you. You will receive the following message if Windows is unable to recognize the command: ‘[Command]’ is not recognized as an operable program, batch file, internal or external command.

An example of a typo and the error message in an open command prompt.

But entering the incorrect command certainly has consequences. Windows will carry out the command right away if it is recognized. It would therefore be wise to take your time and make sure everything is correct. Furthermore, unless absolutely necessary, do not use the admin Command Prompt.

Windows Command Prompt Cheat Sheet

The most frequently used Windows OS commands are finally covered. To get the most out of CMD without feeling overwhelmed, keep the list close at hand. You can print it off or keep it open on your desktop.

Basic Commands

Several of the command prompt window’s commands are easy for beginners to use, even if you have never used them before. To help you begin with the fundamentals and expand your knowledge, here is a brief summary:

      • Any command/?: Gives you information about the specific command and what it does
      • ARROW DOWN: Enables you to move forward in history toward the most recent command
      • ARROW UP: Enables you to step through the last called commands from the most recent one
      • call: Tells batch programs from one another
      • cd (change directory): Displays the name of or changes the current directory
      • chkdsk: Scans a disk for errors and delivers a status report
      • cls: Clears the contents of the Command Prompt
      • color: Applies the default console colors
      • Ctrl+A: Moves the caret to the beginning of the line
      • Ctrl+C: Cancels a command you are running
      • Ctrl+E: Moves the caret to the end of the line
      • Ctrl+K: Deletes all characters after the caret
      • Ctrl+L: Clears the screen
      • Ctrl+U: Deletes all characters before the caret
      • date: Displays or sets the date
      • del [file name]: Deletes the selected file
      • dir (directory): Lists all the files and subdirectories in the directory you are currently in
      • echo: Presents messages or turns command-echoing on/off.
      • exit: Quits the current echo setting or the CMD.EXE program
      • find: Searches for a text string in one or multiple files
      • help: Lists many common commands you can use
      • hostname: Prints the name of the current host
      • ipconfig: Provides a network overview for your current connection
      • mkdir [new folder name] (make directory): Creates a new folder
      • pause: Suspends processing of a batch program and displays the message
      • ping: Checks if your computer can reach a remote destination and how long it will take
      • prompt: Specifies a new command prompt
      • rmdir [folder name] (remove directory): Deletes an entire folder if it’s empty
      • sfc: Windows detects and fixes corrupt system files *you need admin access
      • TAB: Autocompletes what you have been writing
      • title: Sets the window title for the command prompt window

It’s time to advance your skill once you’ve mastered the fundamentals. Let’s review the most often used CMD commands for various Windows tasks.

Files & Folders Commands

      • assoc: Displays or modifies file extension associations
      • attrib: Displays or changes file attributes
      • comp: Compares the contents of two files or sets of files
      • compact: Displays or alters the compression of files on NTFS partitions
      • expand: Expands one or more compressed files
      • fc: Compares two files or sets of files and displays their differences
      • find: Searches for a text string in one or multiple files
      • findstr: Searches for string patterns in files
      • md: Creates a directory
      • move: Moves and renames files and directories
      • openfiles: Lists or disconnects files and folders opened on a system *you need admin access
      • print: Prints a text file
      • ren (rename): Renames one or multiple files
      • replace: Replaces files
      • robocopy: Creates robust file copy for Windows
      • tree: Graphically displays the selected folder structure of a drive or path
      • type: Displays the contents of one or more text files
      • xcopy: Copies files and directory trees

Disk & Partition Commands

      • chkdsk: Checks a disk and displays a report
      • chkntfs: Displays or modifies the checking of the disk at boot time
      • convert: Converts a FAT volume to NFTS
      • format: Formats a disk for use with Windows
      • label: Creates, changes, or deletes the volume label of a disk
      • recover: Recovers readable information from a bad or defective disk
      • vol: Displays the disk volume label and serial number, if they exist

Network Commands

      • arp: Displays and modifies the IP to physical address translation tables used by ARP (Address Resolution Protocol)
      • bitsadmin: Creates, uploads or downloads jobs and monitors their progress
      • ftp: Transfers files to and from a computer running an FTP server service
      • ftype: Displays or modifies file types used in file extension associations
      • netsh: Configures, controls, and displays network components
      • netstat: Displays protocol statistics and current TCP/IP network connections
      • route: Manipulates network routing tables
      • systeminfo: Displays OS configuration information for a local or remote machine, including service pack levels

System Information & Configuration Commands

      • driverquery: Enables you to display a list of installed device drivers *you need admin access
      • powercfg: Enables you to control power settings on a local system
      • shutdown: Turns off computer
      • time: Displays or sets the system time
      • ver: Displays the Windows version

You’ll save a tonne of time if you combine commands to run multiple commands at once rather than waiting for each one to finish separately. Commands can be combined by separating them on the same line with a semicolon (;).

Additionally, you have the option to use “only if.” The command and its predecessor are linked. The command that comes after “&&” won’t finish until the preceding command has also been executed successfully. Conversely, if the command comes after “||,” it won’t finish until the one before it has failed.

If you feel that this is insufficient and you would like to expand your understanding of related subjects, you can find a comprehensive list of all commands along with alphabetical explanations on the official Microsoft page.

How To View Your Command Prompt Window History?

The fact that the Command Prompt only saves information from the currently open session is one of its primary drawbacks. Thus, theoretically, you won’t be able to go back and review what you did if you followed instructions and restarted your computer.

Thankfully, there are a few tricks, and we’ve chosen to add them to our cheat sheet for the Windows command prompt as extras.

  • First, you can use the keyboard shortcut:
      • Open a command prompt
      • Run commands
      • Press the F7 key
      • Check the list of recent commands
      • Press the one you want to execute again
      • Hit enter
  • Second, you can search the command history:
      • Open a command prompt
      • Execute commands
      • Press the F7 key
      • Check the list of recent orders
      • Press the F8 key
      • Type what you remember from the line
      • Press the F8 key again
      • If you don’t like the result, press the F8 key again to view another entry
  • Next, you can use the doskey:
      • Launch the Prompt
      • Type doskey/history

It will let you edit command lines, remember commands you’ve typed before, and even make macros.

  • Last but not least, you can export your prompt history to file:
      • Run the CMD as an Administrator
      • Type doskey /h > c:\cmd_history.txt
      • Change the c:\cmd_history.txt to represent the file path and name you want to export your current history to

The Next Step: Windows PowerShell

An alternative to the Windows Command Prompt is PowerShell. It is compatible with Windows, Linux, and macOS and consists of a scripting language, configuration management framework, and command-line shell.

Question: When was PowerShell released?

Answer: In November 2006, Microsoft released PowerShell 1.0 for Windows Vista, Windows Server 2003 SP1, and Windows XP SP2.

The company first made PowerShell available as an optional component that included a number of helpful commands, or cmdlets. Better integration of the cmdlets with their products, including batch files and VB scripts, was their aim.

However, the business just declared that PowerShell will replace CMD.EXE. Thankfully, if you’d rather, you can continue to use the Command Prompt.

Windows Command Prompt vs. Windows PowerShell

The most recent and advanced iteration of the Command Prompt is called PowerShell. You can essentially use it to perform the same commands as CMD. It also makes administrative tasks easier to complete.

Let’s take a quick look at some of their differences so you can better understand both applications.

Command Prompt:

      • Works with Batch commands exclusively
      • You cannot create aliases for commands
      • You cannot pass the output from a command on to other commands
      • Output comes out in the form of text
      • No separate ISE
      • Requires an external plugin for WMI interaction
      • It doesn’t support Linux OS
      • You can only run console-type programs
      • It cannot connect to Microsoft cloud products

PowerShell:

      • Works with Batch commands and PowerShell cmdlets
      • You can create aliases for cmdlets or scripts
      • You can pass the output from a cmdlet on to other cmdlets
      • Output comes out in the form of an object
      • Has a separate ISE
      • It can integrate directly with WMI
      • Fully supports Linux OS
      • You can run all types of programs
      • It can connect to Microsoft cloud products

Which one then should you study? Depending on what you need. PowerShell is a rather recent release. It offers greater compatibility and options, is simple to understand, and many advancements will come quickly. However, the majority of the tasks can be completed with the outdated and all-timer CMD.

Conclusion

Despite being a controversial claim, a CMD is actually far more capable than a GUI. Even better, it’s not just meant for sophisticated or seasoned users. On the contrary, actually. Beginners can also benefit from the Windows prompt’s ease of use and efficiency in terms of time.

In the end, it is worthwhile to become familiar with the Windows command prompt. And the best way to maximise your Windows experience is to start with our cheat sheet for the Windows command prompt!

Related Articles