Essential CMD Commands for Windows Users (original) (raw)

Last Updated : 12 Jan, 2026

The Windows Command Prompt (CMD) is a powerful tool that allows users to interact with their operating system through text-based commands.

1. CMD Commands for Beginners

These commands are essential for users who are new to CMD and provide basic functionalities to help them navigate and perform simple tasks.

**1. View Directory ' dir '

**Syntax: dir

dir

2. Change Directories 'cd'

**Syntax: cd [folder name]

cd

3. Create a New Directory 'mkdir' or 'md'

**Syntax: mkdir [GFG]

mkdir

4. Rename a File 'ren'

**Syntax: ren xyz.txt newxyz.txt

ren

5. Delete a File 'del'

**Syntax: del[file_name]

del

6. Close 'exit'

**Syntax: exit

exit

7. Clear Screen 'cls'

**Syntax: cls

cls

8. View Available Command 'help'

**Syntax: help

help

time

9. Display or Set the System time 'time'

**Syntax: time [new_time]

time

10. Copy Files 'copy'

**Syntax: copy file.txt Backup\

copy

**Command **Description **Syntax **Example
dir View the contents of a directory dir dir C:\Users\Documents
cd Change the current working directory cd [directory_name] cd Downloads
mkdir Create a new directory mkdir [directory_name] mkdir NewProject
ren Rename a file ren [old_name] [new_name] ren draft.txt final.txt
del Delete a file del [file_name] del unwanted.txt
exit Close the Command Prompt exit exit
cls Clear the Command Prompt screen cls cls
help View available CMD commands and their descriptions help help
time Display or set the system time time time 14:30:00
copy Copy files from one location to another copy [source] [destination] copy report.docx D:\Backup\

2. CMD Commands for Experts

These commands are more advanced and suitable for users comfortable with troubleshooting and system management tasks.

1. System File Checker 'sfc'

**Syntax: sfc /scannow

sfs

2. Disk Error 'chkdsk'

**Syntax: chkdsk C: /f

chkdsk

3. View Running Processor 'tasklist'

**Syntax: tasklist /fi "imagename eq [process name]

task

4. Restart 'shutdown'

**Syntax:
Shutdown: shutdown /s /f /t [seconds].
Restart: shutdown /r /f /t [seconds].

shutdown

5. Network Statistics 'netstat'

**Syntax: netstat

netstat

6. Kill a Running Process 'taskkill'

Example (PID: 1124)

**Syntax: taskkill /PID 11234 /F

taskkill

7. View Saved Passwords 'netsh wlan show profiles'

**Example: netsh wlan show profile name="MyHomeWiFi" key=clear

wifi

**Command **Description **Syntax **Example
sfc System File Checker - Scans and repairs system files sfc /scannow sfc /scannow
chkdsk Check Disk - Scans and fixes disk errors chkdsk [drive]: /f /r chkdsk C: /f /r
tasklist View running processes tasklist tasklist
shutdown Shutdown or restart the system shutdown /r /t [seconds] shutdown /r /t 10 _(Restart in 10 seconds)
netstat View network statistics and active connections netstat -a netstat -an _(Show all connections numerically)
taskkill Kill a running process using its process ID (PID) taskkill /PID [PID] /F taskkill /PID 4567 /F _(Kill process with ID 4567)
netsh wlan show profiles View saved Wi-Fi network names netsh wlan show profiles netsh wlan show profiles

3. CMD Commands for Utility

These commands are focused on specific tasks and utilities to enhance productivity and system performance.

1. Network Configuration 'ipconfig'

**Syntax: ipconfig

ip

2. Network Connectivity 'ping'

**Syntax: ping geeksforgeeks.org

ping

3. System Information 'systeminfo'

**Syntax: systeminfo

1

4. Trace Route 'tracert'

**Syntax: tracert geeksforgeeks.org

2

5. Manage Drives 'diskpart'

**Syntax: diskpart

3

6. Delete a Directory 'rmdir'

**Example: GFG - Directory name

**Syntax: rmdir GFG

4

7. View 'rmdir'

**Example: GFG - Directory name

8. Manage User Account 'net user'

**Syntax: net user username password /add

5

9. View Startup Programs 'wmic startup get caption,command'

**Syntax: wmic startup get caption,command

6

**Command **Description **Syntax **Example
ipconfig View network configuration, including IP address, subnet mask, and gateway ipconfig ipconfig /all _(Displays detailed network info)
ping Test network connectivity by sending packets to a host ping [host or IP] ping google.com _(Check connection to Google)
systeminfo Display detailed system information, including OS version, installed memory, and processor systeminfo systeminfo
tracert Trace the route packets take to a network destination tracert [hostname or IP] tracert google.com _(View network path to Google)
diskpart Manage disk partitions, including creating, formatting, and deleting partitions diskpart diskpart → list disk → select disk 1 → create partition primary
rmdir Delete a directory (folder) rmdir [directory_name] rmdir /s /q OldFolder _(Delete a folder and its contents without confirmation)
dir View contents of a directory dir dir C:\Users\Documents _(List files in a specific directory)
net user Manage user accounts, including adding, modifying, or deleting users net user net user John password123 /add _(Create a new user account)
wmic startup get caption,command View startup programs and their commands wmic startup get caption,command wmic startup get caption,command

4. CMD Commands for Troubleshooting

1. File Comparison 'fc'

**Syntax: fc 1 2

13

2. **Advanced Network Diagnostics 'pathping'

**Syntax: pathping geeksforgeeks.org

14

3. Registry Editor 'regedit'

**Syntax: regedit

15

4. View MAC 'getmac'

**Syntax: getmac

16

5. Power Configuration 'powercfg'

**Syntax: powercfg /energy for a detailed power usage report

17

6. Enable Boot Manager 'bcdedit'

**Syntax: bcdedit /set {current} bootmenupolicy standard

19

7. Format a Drive 'format'

**Syntax: format D: /FS:NTFS

18

**Command **Description **Syntax **Example
fc Compare two files and highlight differences fc [file1] [file2] fc file1.txt file2.txt _(Compare two text files)
pathping Perform advanced network diagnostics with packet loss details pathping [destination] pathping google.com _(Analyze network route to Google)
regedit Open the Windows Registry Editor (GUI) regedit regedit _(Opens the registry editor – use with caution!)
getmac Display the MAC (Media Access Control) address of your network adapters getmac getmac /v /fo list _(View MAC addresses in detailed format)
powercfg Manage and analyze power configurations powercfg /[option] powercfg /batteryreport _(Generate a battery usage report)
bcdedit Enable, disable, or modify Windows Boot Configuration bcdedit /set {current} [option] bcdedit /set {current} bootmenupolicy standard _(Enable boot menu in Windows 10/11)
format Format a drive (erase all data) format [drive]: /FS:[filesystem] format D: /FS:NTFS _(Format drive D: with NTFS file system)

5. CMD Commands for Students

Students can use these commands to manage files, perform simple calculations, and even help with tasks like coding and studying.

1. Calculator 'calc'

**Syntax: calc

7

6. CMD Commands for Programmers

Programmers often use CMD to automate tasks, compile code, and test network functionality. These commands can be especially useful for developers working in command-line environments.

1. Compile Java Code 'javac'

**Syntax: javac

8

2. Version Control 'git'

**Syntax: git clone [repository URL]

9

3. Execute Python Script 'python'

**Syntax: python [script.py]

10

4. Run Node.js Scripts 'node'

**Syntax: node [script.js]

11

5. Node Package Manager 'npm'

**Syntax: npm install [package]

12

**Command **Description **Syntax **Example
javac Compile Java source code into bytecode (.class files) javac [filename].java javac HelloWorld.java _(Compile a Java file)
git Version control system for tracking changes in files git [command] git clone https://github.com/user/repo _(Clone a repository)
python Execute a Python script or enter interactive mode python [script.py] python script.py _(Run a Python script)
node Execute JavaScript code using Node.js node [script.js] node app.js _(Run a Node.js script)
npm Manage Node.js packages and dependencies npm [command] npm install express _(Install the Express.js package)

**7. Bonus: CMD Tricks and Tips

To make CMD usage even more efficient, here are some bonus tips:

**1. Save CMD Output to a File

Use the**>** operator to save the output of a command to a text file.

**2. Open CMD in a Specific Directory

Instead of navigating manually, you can directly open CMD in a folder by typing cmd in the File Explorer's address bar.

**3. Use && for Multiple Commands

You can run multiple commands sequentially:

ipconfig && ping google.com

20