Windows Tools Documentation

Overview

The Command Prompt, also known as cmd.exe, is the default command‑line interpreter for Windows. It provides a traditional text‑based interface for running scripts, managing files, and executing system commands.

Launching the Command Prompt

  • Press Win + R, type cmd, then press Enter.
  • Search for “Command Prompt” in the Start menu.
  • Open an elevated prompt: right‑click the shortcut and choose “Run as administrator”.

Common Commands

dir               List files and directories
cd                Change the current directory
copy              Copy files
xcopy             Copy files and directory trees
del               Delete files
mkdir             Create a new directory
rmdir             Remove a directory
type              Display the contents of a file
cls               Clear the screen
exit              Close the command window
chkdsk            Check disk for errors
systeminfo        Display system configuration
ipconfig          Show network configuration
ping              Test connectivity to another host

Command Syntax

Commands follow the pattern:

command [/option] [parameter]

Options are prefixed with /, while parameters are positional arguments.

Examples

List files sorted by size

dir /-C /O-S

Copy a folder recursively

xcopy "C:\SourceFolder" "D:\BackupFolder" /E /H /C /I

Find text in a file

findstr /i "error" application.log

Environment Variables

Access system and user variables using %VARIABLE_NAME%. Useful variables include:

  • %PATH% – Directories searched for executable files.
  • %TEMP% – Temporary files folder.
  • %USERNAME% – Current user name.
echo %PATH%

Batch Files

Save a series of commands in a .bat or .cmd file to automate tasks.

@echo off
rem Example batch file
setlocal
echo Starting backup...
xcopy "%USERPROFILE%\Documents" "D:\Backup\Docs" /E /H /C /I
echo Backup complete.
endlocal
pause

Further Reading