Command Prompt Textbook
Introduction to Command Prompt
Four ways to close Command Prompt (× button, right-click menu, exit command, Alt + F4), plus how to stop a running comma
Learn the difference between the batch file extensions .bat and .cmd: the one real behavioral difference (ERRORLEVEL), w
How to open Command Prompt on Windows 11 and 10: Start search, Win+R, Windows Tools, the folder address bar and Task Man
How to run Command Prompt as administrator. Quick reference for the Shift+Ctrl+Enter shortcut, Start menu, Win+X, Task M
List of Commands
Learn how to use the arp command to check the table (ARP table) that maps IP addresses to MAC addresses for devices on t
Learn how to view and change the link between file extensions and apps using the assoc and ftype commands in Command Pro
Use the attrib command in Command Prompt to view and change file and folder attributes: read-only, hidden, system, and a
Learn how to run another batch file from a batch file with the call command. Covers why control does not return without
Learn how to change directories with the cd (chdir) command in Command Prompt and batch files: moving to a parent direct
Learn how to use the CERTUTIL command to calculate SHA-256 or MD5 hashes and check that a downloaded file is not corrupt
Learn how to check and change the Command Prompt code page with the chcp command. Covers 932 (Shift_JIS) vs 65001 (UTF-8
Learn how to scan and repair drive errors and bad sectors with the chkdsk command. Covers the difference between /f and
Use the choice command to let the user pick Yes/No or other options in the command prompt or a batch file. Learn the /c,
Learn how to use the cipher command to encrypt NTFS files and folders (EFS) and to overwrite deleted data left in free d
Tips
Learn how to pass arguments to a batch file and read them with %1 and %2. Covers call versus start, counting arguments,
Learn how to make a batch file automatically display the UAC elevation dialog and restart itself with administrator priv
A beginner-friendly guide to creating batch files (.bat). Learn how to make one in Notepad, what @echo off means, how to
Use set /a to do math in Command Prompt and batch files. Covers arithmetic, remainders (%%), counters, random numbers, a
Learn the differences between &, &&, and || for running multiple commands on one line in Command Prompt. Covers grouping
Learn how to copy and paste text in Command Prompt. Ctrl+C and Ctrl+V work in Windows 10/11, while older versions or cer
Learn how to create a 0-byte empty file from Command Prompt or a batch file using type nul, copy nul, and echo;, with co
Learn how to create folders from Command Prompt or a batch file with the mkdir (md) command: nested folder structures, n
Use the cd command to display the current directory in Command Prompt or a batch file. Learn the difference between %cd%
Learn how to get and format the date and time in batch files. Covers the %DATE% and %TIME% variables, using them in file
All articles
- arp - Check IP-to-MAC Address Mappings
- Assigning a Network Drive 2
- assoc / ftype - File Associations
- attrib - Change file attributes
- Batch File Extensions
- Calculation (Arithmetic)
- call - Execute Other Batch Files
- cd/chdir - Changing Directories
- CERTUTIL - Hash Values & Base64
- Chaining Commands
- Character Encoding and Garbled Text
- chcp - Switch the Character Encoding
- Checking File Existence
- chkdsk - Check and Repair Disk Errors
- choice - Prompt the user for input
- cipher - Encrypt Folders and Wipe Free Space
- CLIP - Copy to Clipboard
- Closing Command Prompt
- cls - Clear Screen
- cmd - Start the command processor
- color / title - Colors and Window Title
- copy - File Copying
- Copying and Pasting Text
- Create a New Folder
- Create Empty File
- Creating Variables
- curl - Download and Send Data over HTTP
- del/erase - Delete files
- Delayed Expansion
- Delete Files and Folders
- dir - Search for files
- diskpart - Manage Disks and Partitions
- Display Current Folder
- DOSKEY - Macros and Aliases
- driverquery - List Installed Drivers
- echo - Display Text
- Error Messages and Fixes
- ERRORLEVEL
- Escaping Special Characters
- exit - Terminate a program
- FC - Compare Files
- find - Search for Text in Files
- findstr - Advanced Text Search
- for - Loop Command
- FORFILES - Process Files in Bulk
- fsutil - Inspect and Manage the File System
- getmac - Check MAC Addresses
- Getting Date and Time
- goto - Jump to a Label
- Help (HELP and /?)
- How to Create a Batch File
- icacls - View and Change Permissions
- if - Conditional Branching
- ipconfig - Check IP Address
- Launching Command Prompt
- mklink - Create Links
- MODE - Window Size and Key Repeat
- more - Control the Text Displayed at Once
- move - Move files and folders
- Move to a Different Directory
- net - Manage Users, Services, and Shares
- netsh - View and Change Network Settings
- netstat - Check network connections
- nslookup - Look Up DNS Records
- Passing Arguments to Batch Files
- pathping - Find packet loss along a route
- PAUSE - Pause
- Persistent Environment Variables and PATH
- ping - Network Connectivity Check
- Pipes and Filters
- powercfg - Check Power Settings and Battery
- prompt - Customize the Command Prompt
- pushd, popd
- rd/rmdir - Delete a folder
- Reading User Input
- Redirection
- reg - Work with the Registry
- rem - Comment
- Renaming Files
- robocopy - Advanced Copy
- route - View and Edit the Routing Table
- Run as Administrator
- Run PowerShell from Command Prompt
- runas - Run as a different user
- sc - Manage Services
- schtasks - Task Scheduler
- Searching for Files
- setlocal, endlocal
- sfc / DISM - Repair System Files
- SHUTDOWN - Shut Down
- SORT - Sort Lines of Text
- start - Run Other Batch Files
- String Operations
- Subroutines and Return Values
- subst - Assign a Folder to a Drive
- SYSTEMINFO (System Information)
- TAR - Compress and Extract
- taskkill - Terminate Processes
- tasklist - List Running Processes
- timeout - Wait
- Tips and Tricks
- tracert - Trace the Network Route
- tree - Display Directory Structure
- type - Display a Text File
- UAC Auto-Elevation
- wevtutil - Inspect event logs
- WHERE - Find Executables
- whoami - Check the Current User
- Wildcards
- WINGET - Package Manager
- xcopy - Advanced File Copy