In this article, we’ll cover the 30 Windows command prompt commands to troubleshoot and manage Windows devices.
1. Launching Command Prompt
- To start, press the Windows Key + R on your keyboard
- Enter ‘cmd‘ and click ‘OK’
- Commands are typed into this screen, followed by the ‘Enter’ key on your keyboard.
2. IP Configuration
ipconfig
: View your computer’s IP address and basic network information.ipconfig /all
: Get more detailed information, including MAC addresses and DNS servers.ipconfig /displaydns
: See all the websites your computer knows about and their IP addresses.ipconfig /flushdns
: Delete your DNS resolver cache, removing old, stale DNS entries.
3. Filtering Output with Find String
findstr
: Use this command to filter output from other commands, such asipconfig /all | findstr DNS
.
4. IP Address Management
ipconfig /release
: Release your current IP address.ipconfig /renew
: Renew your IP address from the DHCP server.
5. Troubleshooting DNS
nslookup
: Look up the IP address of a domain, and get information about the DNS server being used.nslookup example.com [DNS server]
: Get a second opinion on a domain’s IP address using another DNS server.
6. Copy Output to Clipboard
command | clip
: Copy the output of a command to your clipboard.
7. Check MAC Address
getmac /v
: Display all MAC addresses for your computer.
8. Power Configuration
powercfg /energy
: Check for energy or power issues.powercfg /batteryreport
: Generate a battery report.
9. File Associations
assoc
: Show file types and their associated programs.
10. Clean Screen
cls
: Clear your command prompt screen.
11. Checking Disk Health
chkdsk /f
: Check and repair disk errors.chkdsk /r
: Check and repair physical sector issues.
12. System File Checker
sfc /scannow
: Check and repair system files, including DLL files.
13. Deployment Image Servicing and Management (DISM)
dism /online /cleanup-image /checkhealth
: Check the health of your system image.dism /online /cleanup-image /restorehealth
: Repair your system image.
14. Task Management
tasklist
: List all running tasks.taskkill /f /pid [PID]
: Forcefully terminate a task using its process ID.
15. Network Shell (Netsh)
netsh wlan show wlanreport
: Generate a wireless report.netsh interface show interface
: Show your network interfaces.netsh advfirewall set allprofiles state off
: Turn off the Windows Defender Firewall (use cautiously).
16. Ping and Traceroute
ping
: Check if a website or server is up and responding.ping -t
: Continuously ping a website or server.tracert
: Trace the route to a website or server.
17. Netstat
netstat -a
: Display all open ports and connections.netstat -o
: Show process IDs for all connections.
18. System Information
systeminfo
: Get detailed information about your computer’s hardware and software.
19. Services Management
sc query
: List all services on your computer.sc start [service_name]
: Start a service.sc stop [service_name]
: Stop a service.sc config [service_name] start= auto
: Set a service to start automatically.
20. User Accounts
net user
: List all user accounts on your computer.net user [username]
: Display information about a specific user account.net user [username] /active:yes
: Activate a user account.net user [username] /active:no
: Deactivate a user account.net localgroup administrators [username] /add
: Add a user to the administrators group.
21. Windows Management Instrumentation (WMIC)
wmic qfe list
: List all installed Windows updates.wmic process list brief
: List running processes with basic information.
22. System Uptime
systeminfo | findstr /c:"System Boot Time"
: Check your computer’s uptime since the last reboot.
23. Time and Date
time
: Display the current time.date
: Display the current date.
24. Remote Desktop Connection
mstsc
: Launch the Remote Desktop Connection client.
25. File and Folder Operations
dir
: List files and folders in the current directory.cd
: Change the current directory.md
: Create a new folder.rd
: Remove a folder.del
: Delete a file.xcopy
: Copy files and folders, including subfolders.robocopy
: A more advanced file copy command, allowing for various options and settings.
26. Boot Configuration Data Editor
bcdedit
: View and edit your computer’s boot configuration data.
27. Event Viewer
wevtutil qe System /c:5 /rd:true /f:text
: Query the Event Viewer for the last five System events.
28. Resource Monitor
perfmon
: Launch the Resource Monitor to view system performance.
29. Disk Cleanup
cleanmgr
: Launch the Disk Cleanup utility.
30. File Compression
compact
: Display or alter file compression settings.