Tips for Windows console
Tips for Windows console
20 Commands Detailing Windows Console Tool
The Windows console may seem outdated, difficult to use or superfluous in an era where graphical interfaces completely dominate interaction with OS and apps.
Nevertheless, It is still really useful so that system administrators or advanced clients can perform tasks in a much more flexible and faster way, sometimes where the interface is disabled, to manage certain elements or access certain information that is not available in any other way.
The Windows console is a tool similar to the Linux Terminal or the corresponding macOS console.
And despite the news of the interface of recent systems like Windows 11, Microsoft has not forgotten about her.
Quite the opposite, it has reinforced it with the publication of Windows Terminal, a tool created independently of Windows, free and released as open source.
Microsoft wants to transform Terminal into the Windows console determinant, but it coexists with the other 2 apps installed by default in Windows, the command prompt (CMD) and the much more advanced version for system managers, PowerShell.
They can be accessed in different ways.
The much simpler one:
- Command Prompt: Type 'CMD' in the Windows search box. You can choose to run it in user mode (with limits) and also in manager mode with access to the entire device.
- PowerShell: Type 'PowerShell' in the Windows search box.
- Windows Terminal: Download the app from your GitHub pageFrom Terminal, you can use both CMD and PowerShell in separate tabs. And in Windows 11, you can select it as the default command line app.
20 Windows Console Commands
Whether you use a console app or another, they run in text mode.
The design will remind you of a system like MS-DOS and is not as deducible as an interface, although it can be customized in design, colors or fonts, especially the new Windows Terminal that we recommend you evaluate.
Its performance itself is simple: We write the command (and its modifiers if applicable) and these apps will act as interpreters for its execution.
There are many commands that we can use for a wide variety of tasks.
We leave you with some of the most essential ones:
HelpA good way to start is through the “help” command, which will show us a list of all the available commands. “Help + command name” will show us information about a specific command, while “Command name + /?” will show us all the modifiers and options for the command.
Systeminfo. Another one generally displays OS configuration information of a local or remote device, including Service Pack settings.
It reports the installed processor, the physical and virtual RAM used and free, the BIOS, the motherboard manufacturer, as well as the OS version used and all installed updates.
AssocMost Windows files are associated with a specific program assigned to open the file by default.
This command displays or alters file extension associations.
Chkdsk. Check the status of a hard drive/partition/volume and display a status report.
Fix disk errors or find damaged fields and recover information.
CMD. Starts a new instance of the Windows command interpreter.
Dir and Del. Displays the list of files and subdirectories in a folder.
Delete one or more files, useful with those stubborn files that can't be removed from the platform.
Driverquery. Gadget drivers are among the most essential software installed on the PC.
Its removal or poor installation is a constant source of problems.
This command lists each and every driver you have on the machine, its name, driver type, link date, or directory where it is installed.
Diskpart. A super utility for managing storage entities, whether internal or external, and capable of managing disks, partitions, volumes or virtual hard drives.
Format. Formats an internal or external disk for use in Windows.
Powercfg. Strong command for the power management of the device.
Power saving, sleep or hibernation states.
Creates a detailed report of power consumption on a PC that suggests a failure due to this reason.
Windows 8 has added a switch that gives a detailed analysis of a laptop's battery usage, capacity, charge status or recharge cycles.
Shutdown. Shut down, restart, or hibernate the local device.
It has a lot of modifiers to schedule shutdown or restart, a logout apart from forcing the shutdown of apps.
It is also used to document an unexpected system shutdown.
Sfc. Examines the integrity of each and every protected system file and replaces incorrect versions with the correct ones from Microsoft.
The command checks for missing or corrupted files, automatically replacing them using cached copies on the system.
Ipconfig. It is among the most useful network commands.
Reports recent TCP/IP network configuration settings and updates DHCP and Domain Name System (DNS) protocol settings.
Ping. Tests the communication status of the local host with one or multiple remote computers on an IP network.
By sending ICMP packets, it diagnoses the status, speed and quality of a given network.
Tracert. Allows you to understand packets coming from a host (network point).
Statistics are also obtained on the RTT or network latency of these packets, offering an estimate of the distance between the communication ends.
Pathping. Combines the ping and tracert tools.
It is much more informative, which means it takes much longer to complete.
After sending packets to a specific destination, the route taken is examined and packet loss and data between 2 hosts is calculated.
Getmac. Get the MAC address of the device where it runs. The MAC address is a precise 48-bit identifier configured by the IEEE and the developer (24 bits each).
Also famous as a physical address is unique for each device.
Nslookup. It is used to understand if the DNS is properly resolving names and IPs.
It also lets us know the IP address behind a specific domain name.
If you want to turn an IP address into a domain name, just type it into your browser and see where it leads.
Netstat. Strong command that displays network statistics and allows diagnostics and analysis.
By default, displays a catalog of a PC's active connections, both incoming and outgoing.
Includes the protocol in use, routing tables, interface statistics, and connection status.
Netsh. Homonym of network shell, it allows you to change, manage and diagnose the configuration of a network, with much more appearance and capacity than the previous ones.
An advanced command that provides a bunch of options using its modifiers and as an example, allows you to change the primary and secondary DNS of a device.
Microsoft provides this PDF file with all the available commands and additional information | Windows Commands Reference
Ten tricks for the Windows console
The preceding commands are just a sample of the options of this Windows command line, whose management we can improve with a series of tricks like the ones we offer you below.
1. Use the function keys. Most of the function keys (F1 to F9) serve a purpose in the Windows console:
- F1: Retypes the last used command, character by character, per keystroke.
- F2: Asks for a character, then returns to typing the last command used up to the first occurrence of that character.
- F3: Rewrite the last used command completely.
- F4: Prompts for a character, then deletes all letters and numbers in the current command, starting from the cursor location to the first occurrence of the requested character.
- F5: It returns to writing the previously used commands completely, but does not activate.
- F6: Types ^Z in today's command.
- F7: Displays a menu of previously used commands.
- F8: Absolutely rewrites previously used commands.
- F9: Retypes a previously used command exactly, corresponding to the number in the menu reported by F7.
2. View the command history. Whenever you want to see all the commands you have typed since the beginning of the session, you can use the “doskey /history” command. Doskey is a tool provided by Microsoft with multiple functionalities, one of which is the command history.
It is essentially exactly the same as pressing F7, but in addition it allows you to store, feed or manage the output of information.
3. Repeats a previous command. If you need to recall a previous command, whether to repeat or edit it, all you need to do is press the up arrow key on your keyboard.
If you keep pressing it, it will continue repeating previous commands starting with the most recent.
Functionally it is similar to using the F8 key except for one difference: the up arrow puts the cursor at the end of the command while F8 puts the cursor at the beginning of the command.
4. Execute multiple commands at once. If you need to run multiple commands, but each one needs a good amount of execution time, you can get ahead 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 finish.
5. Cancel a running command.
If at any time you run a command and it takes a long time to execute, you can stop it by pressing “Ctrl + C”. This function is also useful when you want to stop an app or service.
6. View information, page by page.
Most Windows commands output information on the screen. Sometimes, it displays a huge amount of information that is still unreachable 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 to another by pressing the space bar key.
7. Filter the output of a command.
If the output of a command is verbose and you need to find a special line or instance of a word, you can filter the output with the command “[command with output] | find “query”.
The search filter is applied line by line, so it will return each and every line that makes up the article in the request.
8. Copy the output of a command.
If you are looking for assistance to fix a system issue, you may need to output the information to an external tool.
And it's annoying if you don't use a command like “[command with output] | clip” that copies the information to the clipboard. From there, with the usual command “Control + V”, you can copy it wherever you want.
9. Stores the output of a command.
If your intention is to store the result of a command in a file, you can use the previous procedure or directly send it to a file with the function “[command with output] > filename.txt”.
The article file will be saved in the location of the command prompt you are using, although you can save it in another location by setting the full path “… C:\folder\filename.txt)”.
ten. Drag and drop files.
If you're working with files in a deeply nested directory and need their complete path names for a command, you have a few options.
You can write them manually.
You can copy the path from the address bar of File Explorer and then type the file name.
Or you can simply drag and drop the file directly into the command prompt.