70+ Essential Windows CMD Commands

File and Directory Commands

  1. dir Lists files/directories.

:: Basic: List all files with details
dir /a
:: Advanced: Find specific file types recursively
dir *.txt /s /p
  1. cd Changes directory.

:: Basic: Navigate to a folder
cd C:\Users
:: Advanced: Switch to path with spaces
cd "C:\Program Files (x86)"
  1. mkdir/md Creates a directory.

:: Basic: Create a single folder
mkdir Data
:: Advanced: Create nested folders
mkdir Parent\Child\Grandchild
  1. rmdir/rd Deletes a directory.

:: Basic: Remove empty folder
rmdir Data
:: Advanced: Delete non-empty folder
rmdir /s /q Data
  1. del Deletes files.

  1. copy Copies files.

  1. xcopy Extended copy for files/directories.

  1. move Moves/renames files.

  1. attrib Changes file attributes.

  1. ren Renames files/directories.

System Information Commands

  1. systeminfo Shows system configuration.

  1. hostname Shows computer name.

  1. ver Shows Windows version.

  1. set Manages environment variables.

  1. wmic Performs system admin tasks.

  1. whoami Shows current user.

  1. tasklist Lists running processes.

Network Commands

  1. ipconfig Shows IP configuration.

  1. ping Tests network connectivity.

  1. tracert Traces route to a host.

  1. netstat Shows connections/ports.

  1. nslookup Queries DNS.

  1. arp Manages ARP cache.

  1. route Manages routing table.

  1. net use Maps network drives.

  1. netstat -an Shows connections numerically.

  1. netsh Configures network settings.

Disk and Drive Commands

  1. chkdsk Checks/repairs disk errors.

  1. diskpart Manages disks/partitions.

  1. format Formats a drive.

  1. label Sets volume label.

  1. vol Shows volume info.

  1. fsutil Manages file system.

Task and Process Management Commands

  1. taskkill Terminates processes.

  • Investigation Context: Detect malicious taskkill use (e.g., targeting MsMpEng.exe) in Defender XDR/Sentinel.

  1. schtasks Manages scheduled tasks.

  1. sc Controls services.

  1. shutdown Performs shutdown/restart/logoff.

  1. start Starts program in new window.

  1. pause Pauses batch file.

  1. timeout Adds delay in scripts.

User and Security Commands

  1. net user Manages user accounts.

  1. net localgroup Manages group memberships.

  1. runas Runs program as another user.

  1. cacls Modifies file permissions.

  1. icacls Advanced file permissions.

  1. lock Locks workstation.

  1. gpupdate Updates Group Policy.

  1. secedit Applies security templates.

Power and Shutdown Commands

  1. powercfg Manages power settings.

  1. shutdown /s /t 0 Immediate shutdown.

  1. shutdown /r /t 0 Immediate restart.

  1. shutdown /l Logs off user.

Windows Troubleshooting Commands

  1. sfc /scannow Repairs system files.

  1. DISM Repairs Windows images.

  1. cleanmgr Launches disk cleanup.

  1. eventvwr Opens Event Viewer.

  1. msinfo32 Shows system info.

Advanced and Miscellaneous Commands

  1. tree Displays folder structure.

  1. echo Displays messages or toggles echoing.

  1. cls Clears CMD screen.

  1. title Sets CMD window title.

  1. color Changes CMD colors.

  1. exit Closes Command Prompt.

  1. prompt Changes CMD prompt.

  1. help Shows command help.

CMD Scripting and Batch Commands

  1. if Conditional logic in scripts.

  1. for Loops through values.

  1. goto Jumps to labeled line.

  1. call Calls another script/function.

  1. setlocal / endlocal Manages variable scope.

Bonus Useful Commands

  1. clip Redirects to clipboard.

  1. find Searches text in files.

  1. assoc Manages file associations.

  1. driverquery Lists installed drivers.

  1. taskview Opens Task View.

Last updated