Windows ⁄8 Command Guide (updated from Vista & Windows7 Commands)
This concise guide lists the most useful command-line tools for Windows 7 and 8, explains what they do, and shows common usage examples. Commands here are backward-compatible with many Vista-era utilities and the earlier “Windows7 Commands” lists; minor syntax differences are noted where relevant.
How to open a command prompt
- Press Windows key → type cmd → press Enter (standard Command Prompt).
- For administrative tasks: right-click cmd → Run as administrator.
- For PowerShell (more modern shell available on Windows ⁄8): press Windows key, type powershell, press Enter.
File and directory commands
-
cd — change directory
Example:cd C:\Users\Alice\Documents -
dir — list directory contents
Example:dir /a /o:n(show all files, sorted by name) -
copy — copy files
Example:copy file.txt D:\Backup</code> -
xcopy — copy files and directories (recursive, more options than copy)
Example:xcopy C:\Project D:\Backup\Project /E /I /H /C -
robocopy — robust file copy utility (recommended for large/complex copies)
Example:robocopy C:\Data D:\Data /MIR /R:2 /W:5 -
del / erase — delete files
Example:del /F /Q C:\Temp*.tmp -
move — move or rename files/directories
Example:move “Old Name.txt” “New Name.txt”
System information and management
-
ipconfig — display and manage TCP/IP configuration
Example:ipconfig /all;ipconfig /release;ipconfig /renew -
ping — test network connectivity
Example:ping 8.8.8.8 -n 4 -
tracert — trace route to a host
Example:tracert example.com -
nslookup — DNS query tool
Example:nslookup example.com -
systeminfo — detailed system configuration and installed hotfixes
Example:systeminfo | more -
tasklist — list running processes
Example:tasklist /v -
taskkill — terminate processes by PID or image name
Example:taskkill /PID 1234 /F;taskkill /IM notepad.exe /F -
sc — service control (query, start, stop services)
Example:sc query wuauserv;sc stop wuauserv -
services.msc — launches Services MMC (GUI) from Run or cmd
Disk and filesystem tools
-
chkdsk — check disk and repair filesystem issues
Example:chkdsk C: /F /R(requires reboot for system volume) -
diskpart — partitioning utility (interactive)
Example: rundiskpart, thenlist disk,select disk 1,clean(careful: destructive) -
format — format a volume
Example:format E: /FS:NTFS /Q -
mountvol — manage mount points and volume GUIDs
Example:mountvol D: \?\Volume{GUID}</code>
System repair and recovery
-
sfc — System File Checker; scan and repair protected system files
Example:sfc /scannow -
DISM — on Windows 8, DISM can repair the component store; on Windows 7 use limited DISM functionality (use Windows 8+ for full features)
Example (Windows 8):dism /online /cleanup-image /restorehealth -
bootrec — repair boot configuration (used from recovery environment)
Example:bootrec /fixmbr;bootrec /fixboot;bootrec /rebuildbcd
User and security management
-
net user — manage local user accounts
Example:net user alice /add;net user alice NewP@ssw0rd -
net localgroup — manage local groups
Example:net localgroup Administrators alice /add -
whoami — show current user and group membership
Example:whoami /groups -
runas — run a program under different user credentials
Example:runas /user:DOMAIN\admin “cmd.exe”
Networking and shares
-
netstat — show network connections and listening ports
Example:netstat -ano | findstr :80 -
netsh — network shell for configuration (interfaces, firewall, routing)
Example:netsh int ip reset;netsh advfirewall set allprofiles state off(careful) -
net share — create/manage SMB shares
Example:net share Public=C:\Public /GRANT:Everyone,READ
Printing and devices
-
print — send a text file to a printer
Example:print /D:\Server\Printer file.txt -
driverquery — list installed drivers
Example:driverquery /v /fo list
Helpful environment and scripting utilities
-
set — display or set environment variables
Example:set PATH;set MYVAR=Value -
echo — display text or variables
Example:echo %USERNAME% -
for — loop construct for batch scripting
Example:for %f in (*.txt) do type “%f” -
schtasks — schedule tasks
Example:schtasks /Create /SC DAILY /TN “Backup” /TR “C:\Scripts\backup.bat” /ST 02:00 -
powershell — launch PowerShell for advanced scripting and cmdlets
Example:powershell -Command “Get-Process | Sort-Object CPU -Descending | Select -First 5”
Tips and best practices
- Use robocopy instead of xcopy for reliability and resume support.
- Run cmd as administrator for system-level commands (diskpart, sfc, chkdsk with /F).
- For complex administration or automation, prefer PowerShell on Windows ⁄8 where available.
- Test destructive commands (format, diskpart clean) in a safe environment before use.
Quick reference table
| Category | Key commands |
|---|---|
| File & dirs | cd, dir, copy, xcopy, robocopy, del, move |
| System info | ipconfig, ping, tracert, nslookup, systeminfo |
| Processes & services | tasklist, taskkill, sc |
| Disk & FS | chkdsk, diskpart, format, mountvol |
| Repair | sfc, dism (Win8), bootrec |
| Users & security | net user, net localgroup, whoami, runas |
| Network & shares | netstat, netsh, net share |
| Scripting | set, echo, for, schtasks, powershell |
Short examples you can copy
- Repair system files:
sfc /scannow - Mirror a folder:
robocopy C:\Source D:\Dest /MIR /R:2 /W:5 - Reset TCP/IP stack:
netsh int ip reset - List listening processes with ports:
netstat -ano | findstr LISTENING - Schedule daily script:
schtasks /Create /SC DAILY /TN “DailyJob” /TR “C:\job.bat” /ST 01:00
If you want a printable cheat sheet with these commands grouped and formatted for quick lookup, say “Generate cheat sheet” and I’ll produce a one-page printable version.
Leave a Reply