Windows CMD Commands
50 essential Windows Command Prompt commands
dir

Lists files and directories in the current directory

cd [directory]

Changes the current directory

mkdir [directory]

Creates a new directory

rmdir [directory]

Removes an empty directory

rd /s /q [directory]

Removes a directory and its contents (use with caution!)

copy [source] [destination]

Copies files or directories

xcopy [source] [destination] /e /h /y

Copies files and directories, including hidden and system files (use with caution!)

move [source] [destination]

Moves or renames files or directories

del [file]

Deletes a file

del /f /q [file]

Deletes a file forcefully (use with caution!)

del /f /q /s [directory]

Deletes all files and subdirectories within a directory (use with caution!)

type [file]

Displays the content of a text file

more [file]

Displays the content of a text file page by page

findstr "[text]" [file]

Searches for a specific text string within a file

ipconfig

Displays network configuration information

ipconfig /all

Shows detailed network adapter info

ipconfig /release

Releases the IPv4 address for all adapters

ipconfig /renew

Renews the IPv4 address for all adapters

netsh interface ip show config

Displays IP configuration details

ping <hostname or IP>

Checks network connectivity

tracert <hostname or IP>

Traces the route to a remote host

pathping <hostname or IP>

Combines ping & tracert for route analysis

netstat -ano

Shows active connections & listening ports (with PID)

route print

Displays the IP routing table

route add <IP> mask <subnet> <gateway>

Adds a static route

systeminfo

Displays system information

tasklist

Lists running processes

taskkill /PID [processID]

Terminates a process

sfc /scannow

Scans and repairs system files

shutdown /s /t 0

Shuts down the computer immediately

shutdown /r /t 0

Restarts the computer immediately

shutdown /h

Puts the computer into hibernation

powercfg /hibernate on

Enables hibernation

powercfg /hibernate off

Disables hibernation

chkdsk [drive]: /f /r

Checks and repairs disk errors

defrag [drive]:

Defragments a hard drive

format [drive]: /q

Formats a hard drive quickly (use with caution!)

attrib +h [file]

Sets the hidden attribute for a file

attrib -h [file]

Removes the hidden attribute for a file

echo [text] > [file]

Writes text to a file

echo %date% > date.txt

Writes the current date to a file

echo %time% > time.txt

Writes the current time to a file

setx [variable] [value]

Creates or modifies an environment variable

regedit

Opens the Registry Editor

whoami

Displays the current user name

net user

Displays user accounts

net localgroup administrators

Displays members of the administrators group

net share

Displays shared resources

net use

Displays network connections

netstat -a

Displays all active connections and ports

arp -a

Displays the ARP cache

nslookup [hostname or IP]

Performs a DNS lookup

ipconfig /flushdns

Flushes the DNS resolver cache

wmic process list brief

Lists running processes (more detailed than tasklist)

wmic useraccount get name

Lists user accounts

robocopy [source] [destination] /mir

Mirrors a directory structure (use with caution!)

cacls [file or directory]

Displays or modifies access control lists

icacls [file or directory]

Displays or modifies access control lists (more advanced than cacls)

takeown /f [file or directory]

Takes ownership of a file or directory

vssadmin list shadows

Lists volume shadow copies

diskpart

Opens the DiskPart utility for managing disks and partitions

msinfo32

Opens the System Information utility

eventvwr

Opens the Event Viewer

perfmon

Opens the Performance Monitor

services.msc

Opens the Services utility

compmgmt.msc

Opens the Computer Management utility

diskmgmt.msc

Opens the Disk Management utility

devmgmt.msc

Opens the Device Manager

control

Opens the Control Panel

control keyboard

Opens the Keyboard settings

control mouse

Opens the Mouse settings

control printers

Opens the Printers settings

control userpasswords2

Opens the User Accounts settings

control timedate.cpl

Opens the Date and Time settings

control powercfg.cpl

Opens the Power Options settings

control display

Opens the Display settings

control sounds

Opens the Sounds settings

control network

Opens the Network and Sharing Center

control appwiz.cpl

Opens the Programs and Features settings

control main.cpl

Opens the System settings

control sysdm.cpl

Opens the System Properties settings

control intl.cpl

Opens the Region and Language settings

control accessibilitycpl.cpl

Opens the Ease of Access settings

control bitlocker.cpl

Opens the BitLocker Drive Encryption settings

control hdwwiz.cpl

Opens the Add Hardware Wizard

control mmsys.cpl

Opens the Sound settings

control desk.cpl

Opens the Display settings

control joy.cpl

Opens the Game Controllers settings

control fonts

Opens the Fonts settings

control colorcpl.cpl

Opens the Display settings

control main.cpl

Opens the System settings

control userpasswords2

Opens the User Accounts settings

control timedate.cpl

Opens the Date and Time settings

control powercfg.cpl

Opens the Power Options settings

control display

Opens the Display settings

control sounds

Opens the Sounds settings

control network

Opens the Network and Sharing Center

control appwiz.cpl

Opens the Programs and Features settings

control main.cpl

Opens the System settings

control sysdm.cpl

Opens the System Properties settings

control intl.cpl

Opens the Region and Language settings

control accessibilitycpl.cpl

Opens the Ease of Access settings

control bitlocker.cpl

Opens the BitLocker Drive Encryption settings

control hdwwiz.cpl

Opens the Add Hardware Wizard

control mmsys.cpl

Opens the Sound settings

control desk.cpl

Opens the Display settings

control joy.cpl

Opens the Game Controllers settings

control fonts

Opens the Fonts settings

control colorcpl.cpl

Opens the Display settings