Your laptop suddenly feels painfully slow. Windows starts behaving strangely. Your Wi-Fi says it is connected, but nothing will load. A program refuses to open. Your computer keeps crashing. Or perhaps you're the person everyone calls when their PC stops working.
Before reinstalling Windows, resetting your Mac, downloading a collection of questionable "PC repair" programs or assuming that your computer needs to be replaced, there are powerful diagnostic and repair tools already built into your operating system.
Some of them have been around for decades. And they are still incredibly useful.
Windows gives us tools such as SFC, DISM, CHKDSK, IPCONFIG, PING, TRACERT, NETSTAT, TASKLIST and POWERCFG. macOS has an equally powerful collection of utilities accessible through Terminal, including tools for network testing, process management, DNS troubleshooting, file-system inspection and system diagnostics.
Whether you're a complete beginner, a hobbyist who enjoys fixing computers, an IT student, a help-desk technician or an experienced IT professional who simply needs a reminder of that command you haven't used in five years, bookmark this guide.
Welcome to the Hashtag Electronics Tech Toolkit.
On this page
Before We Start: CMD, PowerShell and Terminal Aren't Quite the Same Thing
On Windows, you'll commonly encounter two command-line environments:
- Command Prompt (CMD) is the traditional Windows command-line interface.
- PowerShell is Microsoft's newer and considerably more powerful command-line shell and scripting environment.
Many traditional Windows commands work in both. On a Mac, you'll generally use Terminal, which gives you access to the Unix-based command line underneath macOS.
How to open Command Prompt as Administrator
- Open Start.
- Search for Command Prompt or cmd.
- Right-click Command Prompt.
- Select Run as administrator.
- Approve the User Account Control prompt.
You can also search for Terminal or PowerShell and select Run as administrator. When this article says elevated Command Prompt, it means Command Prompt running with administrator privileges.
How to open Terminal on a Mac
Press Command + Space, type Terminal, then press Return. You can also find Terminal under Applications → Utilities → Terminal.
Now let's fix some computers.
PART 1: WINDOWS REPAIR COMMANDS
1. SFC /SCANNOW — The Windows Command Everyone Should Know
Let's begin with one of the most useful Windows repair commands:
SFC stands for System File Checker. Windows contains thousands of protected system files. If some become corrupted, damaged or incorrectly modified, Windows can begin behaving strangely — features not opening, unexplained error messages, applications crashing, Start menu problems, missing system components or general instability.
SFC scans protected Windows system files and attempts to replace corrupted versions with healthy copies.
How to run SFC: Open Command Prompt as Administrator and enter:
The scan can take some time. You may receive messages such as "Windows Resource Protection did not find any integrity violations" or "Windows Resource Protection found corrupt files and successfully repaired them." Sometimes SFC can't repair everything — that's when DISM helps.
2–4. DISM — Repair the Windows Image Itself
DISM stands for Deployment Image Servicing and Management. SFC repairs Windows system files; DISM can help repair the Windows component store that Windows may rely on when performing those repairs.
Start with CheckHealth:
Deeper scan:
Repair:
An internet connection may be required in some repair scenarios. Once DISM completes successfully, run sfc /scannow again.
PART 2: HARD DRIVE AND SSD TROUBLESHOOTING
5. CHKDSK — Check Your Drive for File-System Problems
A commonly encountered repair version is:
The /f parameter tells CHKDSK to fix file-system errors it finds. Because Windows is normally running from C:, Windows may ask whether you'd like to schedule the check for the next restart.
PART 3: WINDOWS NETWORK TROUBLESHOOTING COMMANDS
6. IPCONFIG
For an IT technician, ipconfig /all is often one of the first commands worth running when diagnosing a Windows network problem.
7. IPCONFIG /FLUSHDNS
Windows caches DNS information. Sometimes stale cached information contributes to connectivity issues.
8. IPCONFIG /RELEASE and /RENEW
9–10. PING
Continuous ping (-t) is useful for spotting intermittent connectivity. Press Ctrl + C to stop.
Troubleshooting sequence: ping 127.0.0.1 → ping gateway → ping 8.8.8.8 → ping google.com. If you can ping an IP but cannot resolve a hostname, DNS is a strong suspect.
11. TRACERT
12. NSLOOKUP
13. NETSTAT
Match a PID to a process with tasklist | findstr 6240.
PART 4: WINDOWS PROCESS AND SYSTEM COMMANDS
14–15. TASKLIST & TASKKILL
16–18. SYSTEMINFO, HOSTNAME, WHOAMI
PART 5: LAPTOP BATTERY DIAGNOSTICS
19. POWERCFG /BATTERYREPORT
Compare Design Capacity with Full Charge Capacity to understand how much capacity the battery has lost over time.
20–21. POWERCFG /ENERGY and /SLEEPSTUDY
PART 6: WI-FI TROUBLESHOOTING
PART 7–9: FILE COMMANDS, FINDSTR & TECHNICIAN ESSENTIALS
Useful everyday CMD commands: dir, cd, cls, mkdir, tree /f, and filtering with findstr (e.g. ipconfig /all | findstr DNS).
Core technician toolbox: sfc /scannow, DISM /Online /Cleanup-Image /RestoreHealth, ipconfig /all, ipconfig /flushdns, ping, tracert, nslookup, netstat -ano, tasklist, systeminfo, whoami /all, powercfg /batteryreport.
PART 10: USEFUL MAC TERMINAL COMMANDS
macOS sits on top of a Unix-based foundation. Terminal gives users and technicians access to a serious collection of diagnostic tools.
Navigation & system info
Network
Processes & storage
PART 11: A REAL TROUBLESHOOTING EXAMPLE
Complaint: "The Wi-Fi is connected, but the internet doesn't work."
ipconfig /all— sensible IP, gateway, DNS?ping 127.0.0.1— local TCP/IP stack- Ping the gateway
ping 8.8.8.8— internet by IPping google.com— name resolutionnslookup google.comipconfig /flushdnsif appropriatetracert google.comif needed
That's the difference between guessing and troubleshooting.
PART 12–13: When Windows Feels Corrupted — and When Commands Won't Help
Common sequence for suspected Windows corruption: DISM CheckHealth → ScanHealth → RestoreHealth → sfc /scannow → restart.
A command can repair software. It cannot solder a broken charging port, replace failing NAND, repair damaged RAM, replace a swollen battery, clean years of dust, or fix liquid corrosion. Know when to stop troubleshooting software and start investigating hardware.
PART 14: COMMAND CHEAT SHEET
Windows System Repair
Windows Networking
Windows Diagnostics
macOS Terminal
PART 15–16: Where Beginners and Technicians Should Start
Five commands a beginner should learn first (Windows):
sfc /scannowipconfig /allping google.comipconfig /flushdnspowercfg /batteryreport
Five reminders for IT technicians: DISM /Online /Cleanup-Image /RestoreHealth, netstat -ano, whoami /all, powercfg /batteryreport, nslookup.
PART 17: Learn to Diagnose, Not Just Copy Commands
Being good at computer repair isn't about memorising hundreds of commands. It's about understanding why you're running them. A command is simply a tool used to answer a question.
Need Professional Computer or Laptop Assistance?
Some computer problems can be solved with a command. Others need an experienced technician. Hashtag Electronics provides professional technology support for individuals and businesses in Johannesburg and beyond — computer and laptop repairs, electronics repairs, IT support and related services.
Phone: +27 67 004 3586 · Email: [email protected]
Book a Repair Contact UsFrequently Asked Questions
What is the best CMD command to repair Windows?
Two of the most useful built-in tools are SFC and DISM. A common sequence is DISM /Online /Cleanup-Image /RestoreHealth followed by sfc /scannow.
Is SFC /scannow safe?
SFC is a built-in Microsoft utility commonly used to check protected system files. Back up important data before substantial troubleshooting.
Should I run DISM or SFC first?
If Windows corruption is suspected, DISM can check and repair the Windows image before running SFC.
How do I check my laptop battery health in Windows?
Run powercfg /batteryreport and compare Design Capacity with Full Charge Capacity.
How do I clear DNS cache in Windows?
Open Command Prompt and run ipconfig /flushdns.
Can these commands damage my computer?
Diagnostic commands are generally low-risk when used correctly, but administrator/root-level commands can make significant changes. Never run a command you don't understand. Be especially careful with partitioning, formatting, deletion, permissions or boot configuration.
Final thought: Computers become much less mysterious once you learn how to ask them the right questions. Sometimes that question is sfc /scannow. Sometimes it's ping 8.8.8.8. And sometimes the answer is: "This isn't a software problem at all."
Bookmark this page. Come back when you need it. Every Sunday we'll add another practical guide to the Hashtag Electronics Tech Toolkit.
Hashtag Electronics — Technology Explained. Problems Solved.
This guide is intended for educational and troubleshooting purposes. Commands and available options can vary by Windows/macOS version and system configuration. Back up important data before making significant system changes.