Skip to content

Command Line

Windows CMD Cheatsheet

General Windows Command Prompt commands for administration and utility.

native Client-side

Directory Navigation

6
cd

Display name of or change current directory.

cd /d D:\path

Change drive and folder simultaneously.

dir

List files and subdirectories in current directory.

dir /ah

List only hidden files.

pushd D:\path

Save current directory path and switch to specified path.

popd

Change back to folder saved by pushd.

File Operations

9
type nul > file.txt

Create a new empty file.

mkdir new_folder

Create a new directory (alias: md).

rmdir folder_name

Remove an empty directory (alias: rd).

rmdir /s /q folder_name

Delete directory and all its files recursively in quiet mode.

copy src.txt dest.txt

Copy file to another location.

xcopy /s /i folder_src\ folder_dest\

Copy directory contents and subdirectories.

move src.txt dest.txt

Move file or rename directory.

del file.txt

Delete file (alias: erase).

type file.txt

Display content of text file.

Network Diagnostics

6
ipconfig

Display network adapter details (IP, subnet, gateway).

ipconfig /flushdns

Clear local DNS resolver cache.

ping google.com

Send ICMP Echo requests to host to check connection.

tracert google.com

Trace route packets take to destination.

nslookup google.com

Lookup DNS records of domain.

netstat -ano

Display active network ports and process IDs.

System Commands

6
systeminfo

Display detailed configuration info about local OS.

tasklist

Display a list of currently running processes.

taskkill /pid 1234 /f

Force terminate process by PID.

taskkill /im notepad.exe /f

Force terminate process by name.

gpupdate /force

Force refresh group policy settings.

sfc /scannow

Scan and repair integrity of system files (requires Administrator).

Windows Command Prompt (CMD) Cheatsheet

Windows Command Prompt (CMD) is the default command-line interpreter in Windows NT operating systems. This searchable guide provides a list of utility commands for directories, files, administration, and network diagnostics.

Frequently Asked Questions

How do I run CMD as Administrator?

Press the Windows key, search for cmd, right-click "Command Prompt", and select "Run as administrator". Certain commands (like sfc /scannow or driver management) require elevated system credentials to modify protected files.

What is the difference between CMD and PowerShell?

CMD is a legacy command interpreter with basic features and syntax based on MS-DOS. PowerShell is a modern automation engine built on the .NET framework that utilizes structured objects instead of raw text output.