20 Must Know Windows Commands for Troubleshooting

1. ipconfig

The ipconfig command displays the network configuration of the machine. This is a go to command when trouble shooting network errors or really most errors.

2. ipconfig /all

Adding the /all command provides a comprehensive view of all the network interfaces on a computer, including IP addresses, subnet masks, default gateways, DNS servers, physical addresses (MAC addresses), and other network-related settings.

3. findstr

The findstr command filters text based on a string pattern. Here we use it with the ipconfig command to return all results relating to DHCP. This is the same as grep in Linux.

4. ipconfig /dispalydns

This command displays the DNS cache which contains recently cached records and the corresponding IP addresses.

5. ipconfig /flushdns

This command clears your local DNS cache which may resolve any network connectivity errors you may encounter.

6.clip

Some commands can return a lot of information and it can be helpful to view it in a text editor. The clip command automatically copies to output into your clipboard so can easily paste it into a text editor.

7.nslookup

nslookup is command that allows you to search for an IP address based on it’s associated domain name.

8.assoc

assoc is a command that shows you what each file extension means. If you have a particular file extension you want to search for you can combine it with the findstr command using a “|”.

9.powercfg /energy

The powercfg /energy command is a command-line utility that initiates an energy efficiency analysis and generates a detailed report about the power consumption and energy usage patterns of your computer. You can view the report in your browser by copying and pasting the html file in your command prompt.

10.powercfg /energy

You can also do one for your battery specifically if you are having battery issues using /batteryreport

11.getmac /v

The getmac /v command in Windows is a command-line utility that displays detailed information about the Media Access Control (MAC) addresses associated with the network interfaces on your computer.

12. chkdsk /f

This command is used to check and fix issue related to your disk drive. The /f flag specifies that the command should fix any errors it finds on the specified drive. When you run this command, Windows will scan the drive for file system and disk-related problems and attempt to automatically repair them. This command is particularly useful when you suspect that your disk might have corrupted data, bad sectors, or other issues affecting its functionality and reliability.

13. chkdsk /r

The /r flag specifies that the command should perform a thorough scan of the specified drive and attempt to recover data from any bad sectors it encounters. It attempts to recover information by moving it from bad sectors to healthy one.

14. sfc

sfc stands for System File Checker. When you run this command it checks all the files on your system for sign of corruption and attempts to repair them.

15.DISM

The DISM (Deployment Image Servicing and Management) command in Windows is a command-line utility used for various deployment, maintenance, and repair tasks related to Windows images, including the operating system itself. It’s especially useful for managing and repairing Windows installations, particularly in scenarios where the operating system is not functioning correctly.

The flags in this command specify

  • /Online – the operation should be performed on the currently running operating system
  • Cleanup-Image – This is a subcommand that deals with cleaning up the component store (WinSxS folder) and can include actions like removing older versions of components that are no longer needed.
  • /CheckHealth – A quick scan is performed to check for any corruption issues

The /ScanHealth command performs a much more comprehensive scan of the system

/RestoreHealth performs a thorough scan and attempts to fix any errors found. This is very useful when dealing with problems that are the result of missing or corrupted files in the OS.