How To Perform Common Tasks in Windows Command Prompt
Windows is more than just a graphical user interface. For those of us old enough to remember, our PC journey started with MS-DOS and then Microsoft Windows. The command prompt is where we work, and we had to learn a few tricks to get the job done. To this day, there are complex graphical user interfaces that work very well, but sometimes the command prompt is faster.
In this how-to, we collected many common GUI tasks and showed how to use the command prompt to do the same job. These commands work on Windows 7, 8, 10, and 11.
Access to Command Prompt
1. [スタート]Search for cmd by clicking[管理者として実行]Click. Using admin rights can do some damage, so double-check what you’re typing before pressing Enter.
clear command prompt
The command prompt can get cluttered, but clearing the screen with the cls command can quickly fix it. Typing commands and pressing Enter saves valuable space in the command prompt.
cls
Get network connection details
For network connection details, see[設定]of[ネットワークとインターネット]section, but what if you need them at the command prompt? The ipconfig command provides IPv4 and IPv6 addresses, DNS details, and other basic networking information.
1. At the command prompt, type: ipconfig press enterThis will generate a basic overview of the network connections currently in use.
2. with the same prompt type ipconfig /all and press Enter. Using ipconfig with the /all switch gives a detailed breakdown of all active network interfaces. This includes our Bluetooth adapter and a virtual Ethernet adapter for Virtualbox VMs.
Filtering output with Findstr
Commands can generate large amounts of output. So how do you filter out the noise and target the data you want? The findstr command allows you to pass a string to search for in the command’s output.
Here is an example of using the ipconfig /all command and piping the output through “|”. Input to findstr, which is a quoted search string. In this example, we are looking up the hostname of the machine.
ipconfig /all | findstr “Host Name”
The findstr command can be used with various commands and additional pipes can be used to send the output to other tools/applications.
Check connection
Part of testing your network is to make sure you can connect to another machine, and you can use ping to check internal and external connectivity.
To verify internal connectivity, you need to know the IP addresses of devices on your network. For that, you need to scan the devices on your network. Once you have the IP address, you can use ping to check connectivity.
ping 192.168.0.8
To check external connectivity, you can use ping on the external IP address. The go to IP address is one of Google’s DNS servers.
ping 8.8.8.8
Releasing and Renewing IP Addresses
You may need to release or renew your adapter’s IP address, which is easily done from the prompt.
1. Release all active connections using ipconfig /release. This will free up all connections, Ethernet, Wi-Fi, and Bluetooth.
2. Use ipconfig /release *Eth* to close all connections matching “Eth”. This closes all ethernet connections, but leaves others open.
3. Renew all IPv4 connections using ipconfig /renew. This will force all adapters using IPv4 to update their IP addresses.
Four. Use ipconfig /renew6 to renew all ipv6 connections.
Manage tasks from the command prompt
Windows Task Manager is where you manage the tasks running on your system, but you can also manage tasks directly from the command prompt using tasklist and taskkill.
1. Type the command and press Enter to list all running tasks. This will generate a list of applications, memory usage, and process IDs (PIDs).
tasklist
2. Use findstr to filter the tasks. In this example, we are looking for “Inkscape”.
tasklist | findstr “inkscape”
3. Use taskkill to kill the session using the PID. In this example, Inkscape’s PID is 1544.
taskkill /PID 1544
file association
Clicking on a file should open it in the correct application. You can edit the file type default application through the GUI, but you can also do this through the command prompt. The assoc command is a way to list and add file associations.
1. Use assoc to list the current file and associated applications and press Enter to run.
assoc
2. Find a specific file association using findstr and a string to search for. For this example, let’s search for the application associated with the CSV file.
assoc | findstr csv
3. Associate the CSV file with the text file opened in Notepad. This is safer than opening the file directly in Microsoft Excel where you can check the file before importing it into Excel.
assoc .csv=txtfile
Four. Repeat the search using assoc. You can see that the .csv file is linked to the text file.
assoc | findstr csv
save to clipboard
Saving the output of a command to the clipboard is a painstaking task. Highlight the text and right click to copy and paste it into your document. But what if you could save the output on the fly? clip lets you pipe the output of a command to the clipboard and paste it from there into your document.
1. Run the assoc command and pipe the output to the clipboard. The command’s output is redirected to the clipboard.
assoc | clip
2. Open a text editor and paste the contents of the clipboard.
Detailed system information
The systeminfo command is useful when you need to know everything about your system. This command outputs information similar to the following:
- memory
- CPU
- hot fix
- Communication network
- BIOS
Run the command from the command prompt. You can pipe the output to a clip for easy reading in a text editor.
systeminfo
Automatically reboot BIOS
If you use your computer’s UEFI setup program to make changes (for example, switching the boot order), you need to know the correct key to press to enter the BIOS. Or you can use this command to do everything.
shutdown /r /fw /f /t 0
The basic shutdown command can take several switches.
/r to reboot
Boot into BIOS with /fw
/f kill the application
/t 0 to reboot now. 0 represents zero seconds.