The Windows console may seem old-fashioned, difficult to use or unnecessary in an age where graphical interfaces completely dominate interaction with operating systems and applications. However, is still very useful for system administrators or power users to perform tasks more flexibly and quickly, sometimes where the graphical interface is blocked, to manage certain components or to access certain information that is not available in any other way.
The Windows console is a tool equivalent to the Linux Terminal or the corresponding macOS console. And despite the novelties of the graphical interface of new systems such as Windows 11, Microsoft has not forgotten about it. On the contrary, it has reinforced it with the launch of Windows Terminal, a tool developed independently of Windows, free and released as open source.
Microsoft intends to turn Terminal into the ultimate Windows consolebut it coexists with the other two applications installed by default in Windows, the command prompt (Command prompt â CMD) and the more advanced version for system administrators, PowerShell. They can be accessed in different ways. The simplest:
- Command prompttype ‘CMD’ in the Windows search engine. You can select to run it in user mode (limited) and also in administrator mode with access to the whole computer.
- PowerShell: Type ‘PowerShell’ in the Windows search engine.
- Windows Terminal: Download the application from its GitHub page. From Terminal, you can use both CMD and PowerShell in separate tabs. And in Windows 11, you can select it as the default command line application.
20 Windows console commands
Whether you use a console application or another, they are executed in text mode. The interface will remind you of a system like MS-DOS and is not as intuitive as a graphical interface, although it can be customized in design, colors or fonts, especially the new Windows Terminal that we recommend you try.
Its operation itself is simple type the command (and its modifiers, if any) and these applications will act as interpreters for its execution. There are many commands that we can use for a wide variety of tasks. Here are some of the most important ones:
Help. A good way to start is with the âhelpâ command which will show a list of all available commands. âHelp + command nameâ will show information about a specific command while âcommand name + /?â will show all modifiers and possibilities of the command.
Systeminfo. Another general one displays information about the operating system configuration of a local or remote computer, including service pack levels. It reports the installed processor, the used and available physical and virtual RAM, the BIOS, the motherboard manufacturer, as well as the operating system version used and all installed updates.
Assoc. Most Windows files are associated with a specific program assigned to open the file by default. This command displays or modifies the file extension associations.
Chkdsk. Checks the status of a hard disk/partition/volume and displays a status report. Fixes disk errors or finds damaged sectors and recovers information.
CMD. Starts a new instance of the Windows command interpreter.
Dir and Del. Displays the list of files and subdirectories in a folder. Deletes one or more files, useful with those unruly files that cannot be deleted from the graphical interface.
Driverquery. Device drivers are among the most important software installed on the PC. Their removal or improper installation is a constant source of problems. This command lists all the ones you have on the machine, their name, driver type, link date or directory where they are installed.
Diskpart. A super utility for managing storage drives, whether internal or external, and with the ability to manage disks, partitions, volumes or virtual hard disks.
Format. Formats an internal or external disk for use in Windows.
Powercfg. Powerful command for the energy management of the equipment. Energy saving, sleep or hibernation states. Creates a detailed report of the power consumption on a PC that allows to know a failure for this reason. Windows 8 has added a modifier that provides a detailed analysis of a laptop’s battery usage, capacity, state of charge or recharge cycles.
Shutdown. Shutdown, restart or hibernate the local computer. It has a lot of modifiers to time schedule a shutdown or restart, a logout as well as force shutdown of applications. It is also used to document an unexpected system shutdown.
Sfc. Examines the integrity of all protected system files and replaces incorrect versions with the correct Microsoft versions. The command checks for damaged or missing files, replacing them automatically using cached copies of the system.
Ipconfigthis is one of the most useful networking commands. It reports the current TCP/IP network configuration values and updates the DHCP protocol and Domain Name System (DNS) settings.
Pingtests the communication status of the local host with one or more remote computers on an IP network. By sending ICMP packets, it diagnoses the status, speed and quality of a given network.
Tracertit allows to know the packets coming from a host (network point). It also provides a statistic of the RTT or network latency of these packets, offering an estimate of the distance between the ends of the communication.
Pathpingcombines the utility of ping and tracert. It is more informative, so it takes longer to run. After sending packets to a given destination, it analyzes the route taken and calculates packet loss and provides details between two hosts.
Getmacgets the mac of the computer where it runs. The MAC address is a 48-bit identifier determined and configured by the IEEE and the manufacturer (24 bits each). Also known as a physical address, it is unique for each device.
Nslookupit is used to find out if the DNS is resolving names and IPs correctly. It also allows you to find out the IP address behind a given domain name. If you want to convert an IP address into a domain name, just type it into the browser and see where it leads.
Netstatpowerful command that displays network statistics and allows for diagnostics and analysis. By default, it displays a list of a computer’s active connections, both incoming and outgoing. It includes the protocol in use, routing tables, interface statistics and connection status.
Netshsynonym for network shell, it allows you to modify, manage and diagnose the configuration of a network, with more detail and power than the previous ones. An advanced command that offers a lot of options using its modifiers and, as an example, allows you to change the primary and secondary DNS of a computer.
Microsoft offers this PDF file with all available commands and additional information Windows Commands Reference
10 tricks for the Windows console
The above commands are just a sample of the possibilities of this Windows command line, whose management can be enhanced with a series of tricks like the ones we offer below.
1. Use the function keysmost of the function keys (F1 to F9) have a function in the Windows console:
- F1:Â Retypes the last command used, character by character per keystroke.
- F2:Â Prompts for a character, then retypes the last command used up to the first occurrence of that character.
- F3:Â Completely rewrites the last used command.
- F4:Â Requests a character, then deletes all characters in the current command, starting from the cursor position to the first occurrence of the requested character.
- F5:Â Completely retypes the previously used commands, but does not become active.
- F6:Â Types ^ Z in the current command.
- F7:Â Displays a menu of previously used commands.
- F8:Â Completely rewrites the commands used ??previously.
- F9:Â Completely rewrites a previously used command, which corresponds to the number in the menu presented by F7.
2. View the command history.Â When you want to see all the commands you have typed since the beginning of the session, you can use the command âdoskey /historyâ.Â Doskey is a utility provided by Microsoft with several functions, one of which is command history. It is basically the same as pressing F7, but in addition, it allows you to save, feed or manipulate the output of information.
3. Repeats a previous command If you need to recall a previous command, either to repeat it or modify it, all you have to do is press the up arrow key on your keyboard. If you continue to press it, it will keep repeating previous commands starting with the most recent one. Functionally it is similar to using the F8 key except for one difference: the up arrow places the cursor at the end of the command while F8 places the cursor at the beginning of the command.
4. Executes several commands at once.Â If you need to execute multiple commands, but each one takes a long time to execute, you can preempt them with the command âcd C: && echoâ¦â.Â The commands will be executed in the order you typed them, starting from the left to the right of the console. New commands are not executed until the previous ones are finished.
5. Cancels a command in execution If you ever run a command and it takes too long to execute, you can stop it by pressing âCtrl + Câ. Also useful when you want to stop an application or service.
6. Display information, page by page.Â Most Windows commands produce information output on the screen. Sometimes, it displays a huge amount of information that is inaccessible even if you scroll up. With the command â[command with output] | moreâ we get the console to display the information page by page, moving from one page to another by pressing the space bar key.
7. Filter the output of a command.Â If the output of a command is detailed and you need to find a particular line or instance of a word, you can filter the output with the command â[command with output] | The search filter is applied line by line, so it will return all lines that include the text of the query.
8. Copies the output of a command.Â If you are looking for help troubleshooting a system problem, you may need to get the information out to an external tool. And it’s cumbersome if you don’t use a command like â[command with output] | clipâ which copies the information to the clipboard. From there, with the typical âControl + Vâ command, you can copy it wherever you want.
9. Save the output of a command If your intention is to save the output of a command to a file, you can use the above method or directly send it to a file with the â function[command with output] > filename.txtâ. The text file will be saved to the location of the command prompt you are using, although you can save it to any other location by setting the full path ââ¦ C:folderfilename.txt)â.
10. Drag and drop files If you are working with files in a deeply nested directory and need their full path names for a command, you have a few options. You can type them manually. You can copy the path from the File Explorer address bar and then type the file name. Or you can simply drag and drop the file directly into the command prompt.