Windows 10’s Command Prompt is a powerful tool for troubleshooting, automating tasks, and managing files—but it’s often underused because users don’t know its core commands or when to use it. You can run it once to check disk space, scan for viruses, or modify system settings without needing admin rights in most cases. The real power lies in understanding a few essential commands and knowing which scenarios require them. This guide shows you exactly how to work efficiently, from basic file operations to deeper system diagnostics, with real-world examples and common pitfalls.
What You'll Need
- Windows 10 PC (32-bit or 64-bit) with internet access for updates or manual downloads of reference materials.
- A basic understanding of keyboard shortcuts (Ctrl+C, Ctrl+V, Alt+Tab) to navigate the CMD window faster.
- Optional: A text editor (like Notepad or VS Code) to create custom scripts for repetitive tasks.
Step-by-Step: Essential Commands and Scenarios
- Open Command Prompt:
- Press Win + R, type cmd, and press Enter to open the standard version.
- For admin rights (when needed), press Win + X, select Terminal (Admin) from the menu.
- Check Disk Space and Free Space:
Use the
diskpartorwmiccommands to inspect your storage.- Run
wmic logicaldisk get size,freespace,captionto see all drives and available space. - For a quick summary of free space, type
df -h(if installed) or manually noteC:\’s free space from the previous command.
- Run
- Navigate Files and Directories:
- Use
cdto change directories:cd Documentsmoves you into the folder. - List files with
dirorls(on Windows 10,diris the standard). - To see hidden files, add
/atodir:dir /a.
- Use
- Copy, Move, and Delete Files:
- Copy a file:
copy source_file.txt destination_folder\orcopy source_file.txt destination_folder\. - Move a file:
move source_file.txt new_location\. - Delete a file:
del file.txt(usermdir /sfor folders).
- Copy a file:
- Search for Files and Commands:
- Search Windows for text (not file content) with
where:where notepadshows all Notepad.exe files. - Use
typeto view file contents:type C:\file.txt.
- Search Windows for text (not file content) with
- System Diagnostics:
- Check CPU, RAM, and disk usage with
systeminfoorwmic cpu get loadpercentage. - Scan for malware (if admin rights are available): Run
sfc /scannow(System File Checker) and reboot. - Verify installed programs:
wmic product get namelists all software.
- Check CPU, RAM, and disk usage with
- Create a Batch Script for Repetitive Tasks:
- Open Notepad and write a script (e.g.,
@echo off+ commands likedirorcopy). - Save the file with a
.batextension (e.g.,backup.bat). - Double-click the script or run it from CMD:
backup.bat.
- Open Notepad and write a script (e.g.,
Common Mistakes
- Using incorrect command syntax: Always double-check commands like
moveorcopy. For example, omitting the destination folder name incopy source.txtwill fail. - Running admin commands without elevation: Tools like
sfc /scannowor file deletions require admin rights. Open CMD as admin when unsure. - Overwriting critical system files: Avoid manual deletions in
C:\WindowsorC:\Program Fileswithout confirmation. - Ignoring output warnings: Some commands (e.g.,
rmdir /s) prompt for confirmation. Always read the response.
Tips for Faster Workflow
- Use shortcuts like Ctrl+E to paste from clipboard or Ctrl+R to repeat the last command.
- Enable "Command Prompt and PowerShell" in Windows Features if you rarely use CMD (via Settings > Apps > Optional Features).
- For complex tasks, save CMD history with
cmd /v:onandhistoryto reuse commands later. - Use the
timecommand to check current time and adjust schedules for scripts (e.g.,taskkill /f /im notepad.exeto close an app at a set time).
Troubleshooting
- CMD won’t open:
- Restart your PC. If it persists, check for Windows updates via Settings > Update & Security > Windows Update.
- Run
netsh winhttp reset proxyif a proxy blocks access to CMD resources.
- Commands not recognized:
- Ensure CMD is updated by running
wmic qtto check for missing tools. - Open a new CMD window and type
helpto see all supported commands.
- Ensure CMD is updated by running
- Admin rights denied:
- Run CMD as admin (via Win + X > Terminal (Admin)).
- If you need to modify system files, consider using Windows Terminal with elevated permissions.
- Batch scripts fail:
- Check for typos or missing quotes in arguments. Example:
copy "C:\file.txt" "D:\folder". - Add
@echo offat the top to suppress command-line output (e.g., "file already exists").
- Check for typos or missing quotes in arguments. Example:
Frequently Asked Questions
Why can’t I run some commands without admin rights?
Windows 10 restricts certain commands (like file deletions or malware scans) from non-admin users to prevent system damage. Use CMD as admin when needed, but avoid admin-only commands in scripts unless absolutely necessary.
How do I find all hidden files in CMD?
Use dir /a to list hidden files (those with dots or those prefixed with a .). On newer Windows versions, you can also enable hidden files in File Explorer first via View > Hidden items before running CMD.
Can I use CMD for basic password recovery?
CMD alone cannot change system passwords, but you can use it to verify the current user’s account name with whoami or inspect the registry (advanced users only) via regedit, though registry edits require admin rights and risk system instability.
What’s the difference between CMD and PowerShell?
CMD is simpler for basic file tasks, while PowerShell offers advanced automation (e.g., piping data, managing services). Learn both for maximum flexibility—install PowerShell via Settings > Apps > Optional Features if you need it.
How do I clear the CMD command history?
To delete history, open CMD, type history to see saved commands, then use history | find "command_to_remove" followed by history -s to clear it. Alternatively, restart CMD or run mode con lines=1 to reset the buffer.
Why does sfc /scannow take so long?
This command checks for file corruption in system files, which can take 30+ minutes. During the scan, avoid closing CMD or turning off your PC. If it fails, reboot and retry.