10 useful Command Prompt commands

Stefan
10 useful Command Prompt commands

Command Prompt. Often considered the domain of system administrators and advanced users, it offers several useful commands for every computer user.

While the black and white screen may seem intimidating to some, the Command Prompt is surprisingly accessible, and a little knowledge can make a big difference in working with Windows.

In this article, I offer you 10 of the most useful Command Prompt commands that can save your time and increase your efficiency. Whether you're an IT professional or a curious user eager to learn more about what goes on behind the scenes of your operating system, these commands are essential pillars in your computing arsenal.

10 useful Command Prompt commands

Request system information

You can request system information about your computer via the Command Prompt. You will see various information about settings, Windows, hardware and more, for example:

  • Hostname and domain name.
  • OS configuration, version, build number and installed service packs.
  • System manufacturer, model and type (e.g. x64-based PC).
  • Processor(s) model and speed.
  • BIOS version and date.
  • Total physical memory and available memory.
  • Virtual memory max size and availability.
  • Network cards and their IP address configuration.
  • List of installed hotfixes.

To get system information about your computer from the Command Prompt, type the command:

systeminfo

systeminfo

Request network information

You can also use the Command Prompt to query network information. Querying network information is useful in diagnosing and troubleshooting network problems.

You can use the following command for this:

ipconfig

Ipconfig shows this information by default.

  • Adapter name: The name of the network interface as recognized by Windows.
  • IPv4 address: The IP address assigned to the network interface. This may be set manually or obtained automatically via DHCP.
  • Subnet mask: The subnet mask associated with the IP address, which helps identify the network segment.
  • Default gateway: The local network address of the router or other device that your computer uses to access the Internet or other networks.

However, by entering a more detailed command you can retrieve even more network information. To do this, use the command:

ipconfig /all

Extensive network information will then be shown, such as:

  • Hostname: The name of your computer on the network.
  • Primary DNS suffix: The DNS domain name segment appended to the hostname.
  • Node type: The type of network node communication your system uses.
  • IP routing enabled: Whether IP routing is enabled or not.
  • WINS proxy enabled: Whether Windows Internet Name Service (WINS) proxy is enabled or not.
  • DNS suffix search list: The list of DNS suffixes to search when resolving a short hostname to a full DNS name.
  • Connection-specific DNS suffix: The DNS suffix assigned to a specific network adapter.
  • Description: The description of the network adapter, often the manufacturer's name and model.
  • Physical address (MAC address): The Media Access Control (MAC) address of the adapter.
  • DHCP enabled: Whether the network interface is configured to use DHCP to obtain its IP configuration automatically.
  • DHCP server: The address of the DHCP server that provided the IP configuration.
  • IAID and DUID: DHCPv6 client identifiers.
  • NetBIOS over Tcpip enabled: Whether NetBIOS over TCP/IP is enabled or not.
  • Lease obtained and lease expires: Indicates when the DHCP lease for the IP address has started and when it will expire.
Read also
Remove some settings that are managed by your organization

ipconfig

Shut down, restart or put your computer in sleep mode

We all know the shutdown button on our computer. You can then choose to restart the computer or put it to sleep. This can also be done via a Command Prompt. For this you can use the following command:

shutdown.exe

Shutdown.exe supports many arguments that you must use to perform an action. Here is a list of the arguments you should use in combination with shutdown.exe.

  • /s: Turns off the computer.
  • /r: Restart the computer after shutdown.
  • /g: Restart the computer and restart all registered applications after the restart.
  • /a: Aborts the shutdown process. This can only be used during the shutdown timeout period.
  • /h: Puts the computer into sleep mode.
  • /hybrid: Performs a shutdown and prepares the computer for a quick start. Used together with the /s option.
  • /p: Turn off the computer without delay or timeout. This is the same as /s without timeout.
  • /l: Exit the current user session.
  • /t xxx: Sets the shutdown timeout period to xxx seconds. The valid range is 0-315360000 (10 years), with a default of 30 seconds.
  • /c “comment”: Allows you to specify a reason for the restart or shutdown. The “comment” must be enclosed in quotation marks.
  • /f: Forces closing of running applications without prior warning to the user. Used in conjunction with the /s or /r options.
  • /m \\computer: Allows you to specify a remote computer to shut down or restart.

An example of shutdown.exe to shut down the computer is:

shutdown.exe /s /f /t 20

This will force the computer to shut down after 20 seconds have passed.

shutdown

Look up the IP address of a website

If you want to know the IP address of a website, you can also simply look it up via a Command Prompt. This can be done in two ways. You can use two different commands.

The first command is the ping command. This causes your computer to send a ping packet to the server to which the server responds. You will then see the IP address of the remote server. You have the following command in response to the URL. It is important that you use http, https or www, but only the domain name.

ping pc-tips.info

ping

Another way is to use the nslookup command. You also use nslookup in combination with the URL.

nslookup pc-tips.info

nslookup

Function keys

The function keys (F1 to F12) can provide several useful shortcuts in the Command Prompt, often in combination with the Fn key on certain laptops where the function keys have shared functionality with system commands such as adjust brightness and volume. Here are some standard Command Prompt shortcuts for function keys under Windows:

  • F1: Repeats the letters of the last command one by one.
  • F2: Repeats the last command up to the specified character.
  • F3: Repeats the last command completely.
  • F4: Deletes the current prompt text up to the specified character.
  • F5: Cycles through the history of previously used commands (similar to the up and down arrows).
  • F6: Places a ^Z character in the current line, which is the end-of-file (EOF) character.
  • F7: Provides a visual list of command history where you can use the arrow keys to select a previous command.
  • F8: Cycles through the history of previously used commands, but shows commands that match the current input.
  • F9: Allows you to select a command by entering its number from the command history.
Read also
Enable or disable mono audio in Windows 10? this is how!

If your keyboard has an Fn key, some of these function keys may need to be activated by pressing them at the same time (for example, Fn + F1). This depends on how the keyboard is configured and whether the function keys are set as a primary action or as a secondary action in addition to other system actions.

Execute multiple commands in succession

If you want to execute multiple commands in a row in the Command Prompt, you can use the “&&” command. This command connects multiple commands together and executes them one by one. For example:

ping pc-tips.info && nslookup pc-tips.info

Execute multiple commands in succession

Write output to file

You can write the output of a specific command to a file. This causes the output to go from being displayed in the Command Prompt screen to the file you are creating.

You can use the “>>” command for this. You can also use the “>” command. The difference is that “>>” adds the information to any existing file. The command “>” replaces the entire contents of an existing file. Both create a new file if it does not already exist.

You can use this combination for any command that generates output in a Command Prompt window, for example:

Write output to file

Drag and drop

In many cases a path must be specified in the Command Prompt. For example, this path is needed to run an app or navigate to a certain path.

You can also drag a folder or file into the Command Prompt window at any time. This already specifies the path and you don't have to retype it completely or navigate to it via the “cd” command. This makes working with paths in Command Prompt a lot more effective.

Read also
Want to create a partition on an external hard drive? This is how!

Drag and drop

Show processes

You can also view a list of the running processes within Windows via the Command Prompt. This gives you insight into active processes and allows you to identify them. This is particularly useful for system administrators who need to troubleshoot problems.

You can use the following command for this:

tasklist

You can also extend this command with different options to filter the output or get more detailed information. For example:

  • tasklist /FI “IMAGENAME eq notepad.exe” shows only the instances of notepad.exe that are running.
  • tasklist /SVC shows the services related to each running process.
  • tasklist /V displays detailed information, including the title of the window for each process.

The tasklist command can also be combined with other commands such as taskkill to kill processes based on the information provided by tasklist. This can be useful, for example, to write scripts that automatically monitor and manage certain processes.

tasklist

Close processes

As indicated in the previous chapter. You can also close processes through the Command Prompt. You can use the following command for this:

taskkill

However, Taskkill needs an argument. For example, you can close a process via PID (ProcessID often a number) or via the name of the process. For example:

taskkill /PID 1234

This command ends the process with PID 1234.

taskkill /IM chrome.exe

This ends a process called “chrome.exe”. By combining taskkill with tasklist as described above, you can close certain processes either by process id or by name. This information is displayed via task list in the respective columns, see image above.

Here are some useful arguments you can also use with taskkill:

  • /F: Forces the process to end.
  • /T: Terminates the specified process and all processes started by it (subprocesses).
  • /FI: Allows you to specify a filter for which processes you want to terminate, such as terminating processes by a specific user.

taskkill

I hope this has given you some insight into Command Prompt and commonly used commands. Thank you for reading!

Lees meer:

Stay Informed
Receive a summary of the latest PC tips directly in your email every 2 weeks.
Will you share?
Please help and share this information with other people.
Do you have a computer question?

The email address will not be published. Required fields are marked with *