Photo by Max Deroin from Pexels

Windows Command Cheat Sheet in 2022

Background

Sometimes you log in to a machine that has no administrator privileges and it needs to run a task but not be able to cause it has admin rights. So run a command line and run as administrator. Then from there, you can run any command that will launch the GUI with admin rights.

Other scenarios are where the command line is the only way to run specific tasks and has no GUI.

List of Commands

There are tons of Windows command lines but these are the thing that we normally use for troubleshooting the machine.

Windows Command Prompt

ChkDsk (Check Disk)

Run to locate the bad sector and fix it:

chkdsk /r /f

Note: chkdsk, sfc and dism commands are handy to run to check the system

Cls (Clear Screen)

To clear the screen:

cls

Device Manager

Run the command to launch a Device Manager GUI:

devmgmt.msc

Disk Management

Run the command to launch a Disk Management GUI.

diskmgmt.msc

DISM (Deployment Image Servicing and Management)

Run the command to check the file system image:

dism /online /cleanup-image /checkhealth

Run the command to check the file system image further:

dism /online /cleanup-image /scanhealth

If there is an issue, run the command to restore the file system image:

dism /online /cleanup-image /restorehealth

Note: Always good practice, once you run DISM, then run the sfc /scannow command

Note: chkdsk, sfc and dism commands are handy to run to check the system

IPconfig (IP Configuration)

Run the following:

ipconfig /all

To see the detail filtered by the keyword “DNS”:

ipconfig /all | findstr DNS

To release the IP address from DHCP:

ipconfig /release

To release the IP address from DHCP on a specific interface:

ipconfig /release "Ethernet"

To get a new IP address:

ipconfig /renew

To get all DNS:

ipconfig /displaydns

To get all DNS and save it into the clipboard:

ipconfig /displaydns | clip

Open up the Notepad app and do the Ctrl-V to paste it.

To flush the DNS:

ipconfig /flushdns

GetMac (Get MAC address)

To get the list of MAC addresses:

getmac /v

NetSh (Network Shell)

Run the command to report the wireless LAN:

netsh wlan show wlanreport

Once it is completed, paste C:\ProgramData\Microsoft\Windows\WlanReport\wlan-report-latest.html into the command prompt. This will open up a browser to see the report.

Run the command to show the interface:

netsh interface show interface

Run the command to show the IP address:

netsh interface ip show address
netsh interface ip show address | findstr "IP Address"

Run the command to show the DNS:

netsh interface ip show dnsservers

Run the command to turn off/on the Windows Firewall:

netsh advfirewall set allprofiles state off

netsh advfirewall set allprofiles state on

NetStat (Network Statistics)

To see what is connecting to you and what is connected to:

netstat 

To see what port is open:

netstat -af

To see the connection with the Process ID (PID):

netstat -o

Then you can delete it with the taskkill command (see taskkill)

To see the connection sent and received statistic every 10 seconds:

netstat -e -t 10

NSLookup (Name Server Lookup)

To check the DNS:

nslookup dewapost.com

To check the DNS via Google DNS:

nslookup dewapost.com 8.8.8.8

To check the specific type of DNS i.e. MX records, PTR, TXT records:

nslookup -type=mx dewapost.com

Ping

Run the command to see continuously if the device is alive:

ping -t

PowerCfg

To see the report on energy:

powercfg /energy

Once it is completed, paste C:\Windows\system32\energy-report.html into the command prompt. This will open up a browser to see the report.

To see the report on battery:

powercfg /batteryreport

Route

To see the route to get to a certain network:

route print

To add a new route (in this example: 192.168.20.0) to this 10.x.x.x gateway:

route add 192.168.20.0 mask 255.255.255.255 10.x.x.x

To delete the route:

route delete 192.168.20.0

Services

Run the command to launch a Services GUI.

services.msc

SFC (System File Checker)

Run the following command to check the system file:

sfc /scannow

Note: chkdsk, sfc and dism commands are handy to run to check the system

Shutdown

To shutdown the machine:

shutdown

To restart and then go to BIOS in 30 seconds:

shutdown /r /fw /f /t 30

SystemInfo (System Info)

Run the command to see the quick system info such as OS, BIOS, memory, domain, hotfix, and network cards:

systeminfo

TaskList (Task List)

Run the command to see the task list (in this example, finding the chrome):

tasklist | findstr chrome

TaskKill (Task Kill)

Run the command to see kill the specific task based # Process ID (pid)

taskkill /f /pid #

TraceRT (Trace Route)

To find out the tracing the route to the other end (in this case: dewapost.com)

tracert dewapost.com

To find out the tracing the route to the other end without resolving the domain name running a bit quicker (in this case: dewapost.com)

tracert -d dewapost.com

WMIC (Windows Management Instrumentation Command)

To get the list of applications:

wmic product get name

wmic product get name | findstr Microsoft

To get the list of installed updates:

wmic qfe list

The End

Congratulation on reaching the end of this article. We hope we have shed some light on outlining some Windows command cheat sheets.

*** Let's Discuss ***
We would love to hear about how you deal with the situation and what problems you might be facing. Please feel free to comment below this article or jump into our Dewachat and let us know if you have any questions we can answer! 

We write this so that this is not a fixed article. Like in this journey, we learn as we go and re-write some parts, so please keep pinging with this article.

*** Take a Look ***
To boost your product and service to the broader web community, you can visit our Dewalist classified website – home to 36,000+ active users and 51,000+ one year of active advertising so far.

If you like this post, please check out our other related posts:

*** Try it Out ***
To solve, maintain and monitor Search Engine Optimisation (SEO) and other web challenges, check out our Dewagear tools website – home to 50+ tools so far.

If you love this article or any tech posts and you would like to receive an update of this article or our latest post, please sign up for the form below:

Newsletter signup

This is a newsletter for tech, creative, gadgets, games and crypto.

Please wait...

Thank you for sign up!