Hidden CMD Commands That Can Fix Your Windows OS Instantly


🛠️ Fix Almost Any Windows Issue with 500+ CMD Commands

File & Directory Management

  1. dir – Lists files and folders in the current directory
  2. cd – Changes the current directory
  3. cd.. – Moves up one directory level
  4. md – Creates a new directory
  5. mkdir – Same as md, creates a folder
  6. rd – Removes an empty directory
  7. rmdir – Deletes a directory
  8. del – Deletes files
  9. erase – Same as del, removes files
  10. copy – Copies files from one location to another
  11. xcopy – Copies files and directories (advanced)
  12. robocopy – Robust file copy tool with advanced options
  13. move – Moves files or folders
  14. rename – Renames a file or folder
  15. ren – Same as rename
  16. type – Displays contents of a text file
  17. more – Displays output one screen at a time
  18. fc – Compares two files
  19. attrib – Displays or changes file attributes
  20. tree – Shows directory structure graphically

Disk Management

  1. chkdsk – Checks disk for errors
  2. diskpart – Opens disk partition tool
  3. format – Formats a disk
  4. vol – Displays disk volume label and serial
  5. label – Creates or changes volume label
  6. defrag – Defragments a disk
  7. fsutil – Performs advanced file system tasks
  8. mountvol – Manages volume mount points
  9. recover – Recovers readable data from disk
  10. subst – Maps a path to a drive letter

System Information

  1. systeminfo – Displays system configuration info
  2. hostname – Shows computer name
  3. ver – Displays Windows version
  4. set – Displays environment variables
  5. echo – Prints messages to screen
  6. time – Displays or sets system time
  7. date – Displays or sets system date
  8. cls – Clears the screen
  9. title – Sets window title
  10. path – Displays or sets executable search path

Process Management

  1. tasklist – Lists running processes
  2. taskkill – Terminates a process
  3. start – Opens a program or file
  4. shutdown – Shuts down or restarts computer
  5. logoff – Logs off current user
  6. exit – Closes command prompt
  7. timeout – Waits for a specified time
  8. pause – Pauses execution until key press
  9. call – Calls another batch file
  10. cmd – Starts a new command shell

Networking

  1. ipconfig – Displays IP configuration
  2. ipconfig /all – Shows detailed network info
  3. ping – Tests network connectivity
  4. tracert – Traces route to a host
  5. netstat – Displays network connections
  6. nslookup – Queries DNS records
  7. arp – Displays ARP table
  8. route – Displays/modifies routing table
  9. getmac – Shows MAC address
  10. net – Manages network resources

User & Permissions

  1. whoami – Displays current user
  2. net user – Manages user accounts
  3. net localgroup – Manages local groups
  4. runas – Runs a program as another user
  5. icacls – Modifies file permissions
  6. cacls – Displays/modifies ACLs (older)
  7. takeown – Takes ownership of files
  8. gpupdate – Updates group policies
  9. gpresult – Displays group policy results
  10. net accounts – Displays account policies

Batch & Scripting

  1. setlocal – Starts local environment for batch
  2. endlocal – Ends local environment
  3. for – Runs loop commands
  4. if – Conditional execution
  5. goto – Jumps to label in script
  6. shift – Shifts parameters in batch file
  7. exit /b – Exits batch file
  8. rem – Adds comments in scripts
  9. :: – Another way to comment
  10. choice – Prompts user for input

File Viewing & Search

  1. find – Searches for text in files
  2. findstr – Advanced text search
  3. sort – Sorts input data
  4. clip – Copies output to clipboard
  5. more – Displays output page by page
  6. type – Displays file content
  7. assoc – Displays file associations
  8. ftype – Displays file type associations
  9. where – Locates files in path
  10. comp – Compares file contents

Miscellaneous

  1. help – Lists available commands
  2. color – Changes CMD text color
  3. prompt – Changes command prompt style
  4. doskey – Edits command history
  5. cls – Clears screen
  6. exit – Closes CMD
  7. mode – Configures system devices
  8. print – Prints text file
  9. verify – Checks file write success
  10. title – Sets CMD window title

Advanced File & Directory Operations

  1. pushd – Saves current directory and changes to a new one
  2. popd – Returns to the previous directory
  3. dir /s – Lists files in all subdirectories
  4. dir /a – Shows hidden/system files
  5. dir /o – Sorts directory listing
  6. copy con – Creates a file from keyboard input
  7. replace – Replaces files in directories
  8. move /y – Moves files without confirmation
  9. del /f – Forces deletion of read-only files
  10. attrib +h – Hides a file

Disk & Storage Advanced

  1. diskcomp – Compares two floppy disks
  2. diskcopy – Copies floppy disk to another
  3. format /q – Quick formats a disk
  4. chkdsk /f – Fixes disk errors
  5. chkdsk /r – Locates bad sectors
  6. fsutil volume diskfree – Shows disk free space
  7. fsutil fsinfo drives – Lists all drives
  8. mountvol /l – Lists volume GUIDs
  9. label /mp – Labels mounted volume
  10. defrag /a – Analyzes fragmentation

System & Performance

  1. powercfg – Manages power settings
  2. powercfg /energy – Generates energy report
  3. perfmon – Opens Performance Monitor
  4. resmon – Opens Resource Monitor
  5. taskmgr – Opens Task Manager
  6. msinfo32 – Opens system info GUI
  7. winver – Shows Windows version window
  8. driverquery – Lists installed drivers
  9. driverquery /v – Detailed driver info
  10. logman – Manages performance logs

Networking Advanced

  1. net use – Connects to shared resources
  2. net view – Displays network computers
  3. net share – Manages shared resources
  4. net session – Lists active sessions
  5. net file – Displays open shared files
  6. netstat -a – Shows all connections
  7. netstat -b – Shows executable per connection
  8. netstat -o – Displays process IDs
  9. nbtstat – Displays NetBIOS stats
  10. pathping – Combines ping and tracert

Security & Permissions

  1. cipher – Manages file encryption
  2. cipher /e – Encrypts files
  3. cipher /d – Decrypts files
  4. auditpol – Manages audit policies
  5. secedit – Configures security settings
  6. whoami /priv – Shows user privileges
  7. whoami /groups – Lists user groups
  8. net user /add – Adds new user
  9. net user /delete – Deletes user
  10. net localgroup /add – Adds group

Services Management

  1. sc – Manages services
  2. sc query – Displays service status
  3. sc start – Starts a service
  4. sc stop – Stops a service
  5. sc config – Changes service settings
  6. net start – Starts services
  7. net stop – Stops services
  8. tasklist /svc – Shows services in processes
  9. wmic service list – Lists services
  10. wmic service get name – Gets service names

Windows Management Instrumentation (WMI)

  1. wmic – Opens WMI interface
  2. wmic cpu get name – Shows CPU info
  3. wmic os get caption – Shows OS name
  4. wmic diskdrive list – Lists drives
  5. wmic bios get serialnumber – Gets BIOS serial
  6. wmic memorychip – Displays RAM info
  7. wmic process list – Lists processes
  8. wmic logicaldisk – Lists logical disks
  9. wmic startup – Shows startup programs
  10. wmic useraccount – Lists user accounts

Registry Operations

  1. reg query – Queries registry
  2. reg add – Adds registry entry
  3. reg delete – Deletes registry key
  4. reg export – Exports registry
  5. reg import – Imports registry
  6. reg copy – Copies registry key
  7. reg save – Saves registry
  8. reg load – Loads registry hive
  9. reg unload – Unloads registry hive
  10. reg compare – Compares registry entries

Boot & Recovery

  1. bcdedit – Manages boot configuration
  2. bootrec – Repairs boot issues
  3. bootsect – Updates boot sector
  4. shutdown /r – Restarts system
  5. shutdown /s – Shuts down system
  6. shutdown /l – Logs off user
  7. reagentc – Manages recovery environment
  8. sfc – System file checker
  9. sfc /scannow – Scans and repairs system files
  10. dism – Repairs Windows image

Misc Advanced Commands

  1. assoc .txt – Shows file association
  2. ftype txtfile – Shows file type command
  3. clip < file.txt – Copies file content
  4. hostname > file.txt – Saves output to file
  5. setx – Sets environment variable permanently
  6. echo %cd% – Displays current directory
  7. color 0a – Changes CMD color (green text)
  8. title MyCMD – Sets custom window title
  9. mode con cols=80 – Sets window width
  10. exit /b 0 – Exits script with code

Advanced Networking & Troubleshooting

  1. ipconfig /release – Releases current IP address
  2. ipconfig /renew – Renews IP address
  3. ipconfig /flushdns – Clears DNS cache
  4. ipconfig /displaydns – Shows DNS cache
  5. ipconfig /registerdns – Refreshes DHCP & DNS
  6. netsh – Opens network shell tool
  7. netsh wlan show profiles – Lists saved Wi-Fi profiles
  8. netsh wlan show profile name="WiFi" – Shows Wi-Fi details
  9. netsh wlan export profile – Exports Wi-Fi config
  10. netsh int ip reset – Resets TCP/IP stack
  11. netsh winsock reset – Resets Winsock catalog
  12. netsh advfirewall show allprofiles – Shows firewall status
  13. netsh advfirewall reset – Resets firewall settings
  14. netsh interface show interface – Lists network interfaces
  15. netsh interface ip show config – Shows IP configuration
  16. netsh interface ip set address – Sets static IP
  17. netsh interface ip set dns – Sets DNS server
  18. route print – Displays routing table
  19. route add – Adds route
  20. route delete – Deletes route

Remote Access & System Control

  1. mstsc – Opens Remote Desktop
  2. qwinsta – Lists remote sessions
  3. rwinsta – Resets session
  4. logoff <id> – Logs off remote session
  5. shutdown /m \\computer – Remote shutdown
  6. shutdown /r /m \\computer – Remote restart
  7. psexec – Executes commands remotely (Sysinternals)
  8. winrm – Windows Remote Management
  9. winrm quickconfig – Enables WinRM
  10. query user – Lists logged-in users

Advanced Process & Performance

  1. taskkill /f – Forces process termination
  2. tasklist /fi – Filters processes
  3. start /affinity – Runs program on specific CPU
  4. wmic process where name="app.exe" – Finds process
  5. wmic process call terminate – Kills process via WMI
  6. typeperf – Displays performance counters
  7. logman start – Starts logging session
  8. logman stop – Stops logging
  9. lodctr – Updates performance counters
  10. relog – Converts performance logs

File System & Permissions (Advanced)

  1. icacls /grant – Grants file permissions
  2. icacls /deny – Denies permissions
  3. icacls /remove – Removes permissions
  4. takeown /f – Takes ownership
  5. attrib -h -r -s – Removes hidden/system/read-only
  6. compact – Compresses files
  7. compact /c – Compress file
  8. compact /u – Uncompress file
  9. cipher /w – Wipes free space
  10. fsutil file createnew – Creates empty file

Disk & Volume Deep Tools

  1. diskpart list disk – Lists disks
  2. diskpart select disk – Selects disk
  3. diskpart clean – Removes partitions
  4. diskpart create partition primary – Creates partition
  5. diskpart format fs=ntfs – Formats partition
  6. diskpart assign – Assigns drive letter
  7. diskpart active – Marks partition active
  8. mountvol /p – Removes mount point
  9. chkdsk /x – Forces volume dismount
  10. defrag /x – Consolidates free space

System Repair & Maintenance

  1. sfc /verifyonly – Verifies system files
  2. dism /online /cleanup-image /scanhealth – Checks image health
  3. dism /online /cleanup-image /restorehealth – Repairs image
  4. cleanmgr – Disk cleanup tool
  5. cleanmgr /sageset – Configure cleanup options
  6. cleanmgr /sagerun – Run configured cleanup
  7. powercfg /batteryreport – Generates battery report
  8. powercfg /sleepstudy – Sleep analysis report
  9. wevtutil qe – Queries event logs
  10. wevtutil cl – Clears event logs

Event Logs & Monitoring

  1. eventvwr – Opens Event Viewer
  2. wevtutil el – Lists event logs
  3. wevtutil gl – Gets log configuration
  4. wevtutil sl – Sets log properties
  5. logman query – Lists data collectors
  6. perfmon /report – Generates performance report
  7. typeperf "\Processor(_Total)\% Processor Time" – CPU usage
  8. resmon /cpu – CPU resource monitor
  9. resmon /memory – Memory monitor
  10. resmon /disk – Disk monitor

Advanced Networking & Security

  1. net accounts /lockoutthreshold – Sets lockout policy
  2. netsh firewall show state – Shows firewall state (legacy)
  3. netsh advfirewall firewall add rule – Adds firewall rule
  4. netsh advfirewall firewall delete rule – Deletes rule
  5. netstat -e – Displays Ethernet stats
  6. netstat -r – Displays routing table
  7. netstat -s – Displays protocol stats
  8. arp -a – Displays ARP entries
  9. nbtstat -n – Shows NetBIOS names
  10. nbtstat -c – Shows NetBIOS cache

Environment & Advanced Scripting

  1. set /p – Takes user input in script
  2. set /a – Performs arithmetic operations
  3. for /f – Parses command output
  4. if exist – Checks file existence
  5. if errorlevel – Checks exit codes
  6. call :label – Calls subroutine
  7. exit /b 1 – Returns error code
  8. cmd /c – Runs command and exits
  9. cmd /k – Runs command and stays open
  10. powershell – Launches PowerShell from CMD

Rare & Legacy File Commands

  1. append – Allows programs to open files in specified directories
  2. expand – Extracts compressed files (.cab)
  3. extrac32 – Extracts CAB files (older tool)
  4. makecab – Creates CAB compressed files
  5. lodctr /r – Rebuilds performance counters
  6. unlodctr – Removes performance counters
  7. sort /r – Sorts in reverse order
  8. find /v – Displays lines not containing text
  9. fc /b – Compares files in binary mode
  10. comp /a – Compares files ASCII

Hidden System Utilities

  1. sigverif – Verifies file signatures
  2. verifier – Driver Verifier tool
  3. dxdiag – DirectX diagnostic tool
  4. mrt – Malicious Software Removal Tool
  5. wiaacmgr – Scanner and camera wizard
  6. shrpubw – Shared folder wizard
  7. fsmgmt.msc – Shared folders manager
  8. compmgmt.msc – Computer management
  9. devmgmt.msc – Device manager
  10. diskmgmt.msc – Disk management

Legacy Networking Tools

  1. netsh diag show all – Displays diagnostics (deprecated)
  2. netsh ras show – Shows remote access info
  3. rasdial – Connects/disconnects dial-up/VPN
  4. rasphone – Opens dial-up networking
  5. netsh bridge show adapter – Shows bridge config
  6. netsh lan show interfaces – Shows LAN interfaces
  7. netsh wlan delete profile – Deletes Wi-Fi profile
  8. getmac /v – Detailed MAC info
  9. arp -d – Deletes ARP entry
  10. pathping /n – No DNS resolution

Advanced Boot & Recovery (Rare)

  1. bootrec /fixmbr – Repairs Master Boot Record
  2. bootrec /fixboot – Writes new boot sector
  3. bootrec /scanos – Scans for OS installations
  4. bootrec /rebuildbcd – Rebuilds boot config
  5. bcdedit /enum all – Lists all boot entries
  6. bcdboot – Repairs boot files
  7. reagentc /info – Shows recovery info
  8. reagentc /enable – Enables recovery
  9. reagentc /disable – Disables recovery
  10. shutdown /fw – Boots into firmware (BIOS/UEFI)

Deep System Internals

  1. wmic qfe list – Lists installed updates
  2. wmic baseboard get product – Shows motherboard info
  3. wmic nic list – Lists network adapters
  4. wmic environment list – Shows environment variables
  5. wmic timezone – Displays timezone info
  6. wmic pagefile list – Shows pagefile settings
  7. wmic recoveros – Displays recovery config
  8. wmic cpu get loadpercentage – CPU load
  9. wmic os get lastbootuptime – Last boot time
  10. wmic diskquota list – Disk quota info

Rare Disk & File System Tools

  1. chkntfs – Displays NTFS check status
  2. chkntfs /x – Excludes drive from check
  3. fsutil dirty query – Checks dirty bit
  4. fsutil dirty set – Marks volume dirty
  5. fsutil behavior query – Shows FS behavior
  6. fsutil usn – Manages update sequence number
  7. fsutil quota – Manages disk quotas
  8. mountvol /r – Removes stale mount points
  9. recover /a – Recovers all readable data
  10. subst /d – Deletes virtual drive

Rare Security & Encryption

  1. cipher /k – Creates encryption key
  2. cipher /x – Backs up encryption cert
  3. runas /savecred – Saves credentials (use carefully)
  4. whoami /all – Full user info
  5. net user /expires – Sets account expiration
  6. net accounts /maxpwage – Password max age
  7. auditpol /get – Shows audit policies
  8. auditpol /set – Sets audit policy
  9. secedit /export – Exports security config
  10. secedit /configure – Applies security template

Event & Logging Hidden Gems

  1. wevtutil epl – Exports event logs
  2. wevtutil im – Installs manifest
  3. wevtutil um – Uninstalls manifest
  4. logman create counter – Creates performance counter
  5. logman delete – Deletes data collector
  6. relog /q – Queries log files
  7. typeperf -qx – Lists counters
  8. perfmon /sys – System monitor
  9. eventcreate – Creates custom event
  10. eventtriggers – Configures event triggers (legacy)

CMD Environment Tricks

  1. %cd% – Current directory variable
  2. %random% – Random number generator
  3. %errorlevel% – Last command status
  4. %date% – Current date
  5. %time% – Current time
  6. set var=value – Creates variable
  7. echo %var% – Displays variable
  8. setx var value – Permanent variable
  9. for %i in (*) do echo %i – Loops files
  10. call %var% – Executes variable as command

Hidden CMD Features & Tricks

  1. doskey /history – Shows command history
  2. doskey /reinstall – Reinstalls macros
  3. prompt $p$g – Default prompt format
  4. prompt $t – Shows time in prompt
  5. color /? – Lists color options
  6. cls && echo Done – Chain commands
  7. dir | find "txt" – Pipe output
  8. echo Hello > file.txt – Write to file
  9. echo Hello >> file.txt – Append to file
  10. start . – Opens current folder in Explorer

Expert Debugging & Diagnostics

  1. dbghelp – Debugging helper tools (library support)
  2. drwtsn32 – Dr. Watson debugger (legacy crash tool)
  3. ntsd – NT symbolic debugger
  4. cdb – Console debugger (advanced)
  5. kd – Kernel debugger
  6. windbg – GUI debugger (external tool)
  7. gflags – Enables advanced debugging flags
  8. sxstrace – Traces side-by-side errors
  9. werfault – Windows Error Reporting tool
  10. procdump – Captures process dumps (Sysinternals)

Advanced System Internals

  1. handle – Lists open file handles (Sysinternals)
  2. procexp – Process Explorer tool
  3. autoruns – Shows startup programs (Sysinternals)
  4. vmmap – Displays virtual memory usage
  5. rammap – Analyzes RAM usage
  6. coreinfo – CPU/core details (Sysinternals)
  7. pslist – Lists processes remotely
  8. pskill – Kills remote processes
  9. psinfo – System info (Sysinternals)
  10. psloggedon – Shows logged-in users

Advanced Networking (Deep Analysis)

  1. netsh trace start – Starts network trace
  2. netsh trace stop – Stops trace
  3. pktmon start – Starts packet monitoring
  4. pktmon stop – Stops packet monitoring
  5. pktmon format – Formats packet logs
  6. netsh http show servicestate – HTTP.sys status
  7. netsh winhttp show proxy – Shows proxy config
  8. netsh winhttp reset proxy – Resets proxy
  9. netstat -x – Shows NetworkDirect connections
  10. netstat -y – Shows TCP templates

Advanced Security & Forensics

  1. auditpol /backup – Backs up audit policies
  2. auditpol /restore – Restores audit policies
  3. cipher /c – Displays encryption info
  4. certutil – Manages certificates
  5. certutil -store – Lists certificates
  6. certutil -verify – Verifies certificate
  7. klist – Lists Kerberos tickets
  8. klist purge – Clears Kerberos tickets
  9. whoami /claims – Shows claims-based identity
  10. runas /netonly – Runs with network credentials

Advanced Disk & Storage (Low-Level)

  1. diskshadow – Volume Shadow Copy tool
  2. vssadmin list shadows – Lists shadow copies
  3. vssadmin delete shadows – Deletes shadow copies
  4. wbadmin start backup – Starts backup
  5. wbadmin get versions – Lists backup versions
  6. wbadmin start recovery – Restores backup
  7. fsutil repair query – Shows repair status
  8. fsutil repair set – Configures repair
  9. chkdsk /scan – Online scan
  10. chkdsk /spotfix – Fast repair

Advanced Boot & System Recovery

  1. bcdedit /set – Modifies boot settings
  2. bcdedit /delete – Removes boot entry
  3. bootsect /nt60 – Updates boot code
  4. bootsect /nt52 – Legacy boot code
  5. reagentc /boottore – Boots to recovery
  6. shutdown /o – Opens advanced boot menu
  7. shutdown /hybrid – Hybrid shutdown
  8. shutdown /soft – Soft shutdown
  9. systemreset – Resets Windows
  10. reset – Resets CMD environment

Rare Windows Utilities

  1. at – Schedules tasks (deprecated)
  2. schtasks – Schedules tasks (modern)
  3. schtasks /query – Lists scheduled tasks
  4. schtasks /create – Creates task
  5. schtasks /delete – Deletes task
  6. lodctr /q – Queries performance counters
  7. unlodctr /q – Queries removed counters
  8. timeout /t -1 – Waits indefinitely
  9. waitfor – Synchronizes processes
  10. openfiles – Displays open files

CMD Internals & Power Features

  1. cmd /q – Turns echo off
  2. cmd /v – Enables delayed expansion
  3. setlocal enabledelayedexpansion – Enables dynamic variables
  4. endlocal & set var=value – Exports variable
  5. for /l – Loop with numbers
  6. for /r – Loop directories recursively
  7. for /d – Loop directories only
  8. if defined var – Checks variable existence
  9. set /a x+=1 – Increment variable
  10. call echo %%var%% – Expands delayed variable

Hidden & Rare Gems

  1. assoc | find – Filters associations
  2. ftype | more – Lists file types paginated
  3. color 1f – Blue background, bright white text
  4. prompt $d $t – Shows date and time
  5. echo ^G – Beep sound
  6. cls & dir – Clears and lists files
  7. dir /x – Shows short filenames
  8. dir /q – Shows file owner
  9. dir /r – Shows alternate data streams
  10. more < file.txt – Reads file page-wise

Extreme / Internal / Rarely Used

  1. subst z: c:\path – Creates virtual drive
  2. subst z: /d – Removes virtual drive
  3. verify on – Verifies file writes
  4. verify off – Disables verification
  5. break – Sets Ctrl+C behavior
  6. exit /b %errorlevel% – Returns last error
  7. cmd /a – ANSI output mode
  8. cmd /u – Unicode output mode
  9. start "" cmd /k – Opens new persistent CMD
  10. echo %cmdcmdline% – Shows full CMD command line


Subscribe to my YouTube channel: www.youtube.com/@Stack_Tech

Comments

Popular posts from this blog

Active Directory Overview (Windows Server) for Interview Preparation

Desktop Support Interview Q&A (Beginner Level)

IT Abbreviations Explained for Beginners | Most Asked in Interviews