39 Windows CMD Commands for Everyone (2025 Updated) - GeeksforGeeks (2025)

Table of Contents
CMD Commands for Beginners 1. View Directory 'dir' 2. Change Directories 'cd' 3. Create a New Directory 'mkdir' or 'md' 4.Rename a File 'ren' 5. Delete a File 'del' 6. Close 'exit' 7. Clear Screen 'cls' 8.View Available Command 'help' 9.Display or Set the System time 'time' 10.Copy Files 'copy' CMD Commands for Experts 1. System File Checker 'sfc' 2. Disk Error 'chkdsk' 3. View Running Processor 'tasklist' 4. Restart 'shutdown' 5. Network Statistics 'netstat' 6. Kill a Running Process 'taskkill' 7. View Saved Passwords 'netsh wlan show profiles' CMD Commands for Utility 1. Network Configuration 'ipconfig' 2. Network Connectivity 'ping' 3. System Information 'systeminfo' 4. Trace Route 'tracert' 5. Manage Drives 'diskpart' 6.Delete a Directory 'rmdir' 7.View 'rmdir' 8.Manage User Account 'net user' 9.View Startup Programs 'wmic startup get caption,command' CMD Commands for Troubleshooting 1. File Comparison 'fc' 2. Advanced Network Diagnostics 'pathping' 3. Registry Editor 'regedit' 4. View MAC 'getmac' 5. Power Configuration 'powercfg' 6. Enable Boot Manager 'bcdedit' 7.Format a Drive 'format' CMD Commands for Students 1. Calculator 'calc' CMD Commands for Programmers 1. Compile Java Code 'javac' 2. Version Control 'git' 3. Execute Python Script 'python' 4. Run Node.js Scripts 'node' 5. Node Package Manager 'npm' Bonus: CMD Tricks and Tips 1. Save CMD Output to a File 2. Open CMD in a Specific Directory 3. Use && for Multiple Commands Conclusion Similar Reads References

The Windows Command Prompt (CMD) is a powerful tool that allows users to interact with their operating system through text-based commands. Whether you're a beginner exploring CMD for the first time, an expert troubleshooting advanced issues, or just looking for utility-focused tasks, this guide has you covered.

In this guide, we will provide you with some of the most useful commands for the following:

  • CMD Commands for Beginners
  • CMD Commands for Experts
  • CMD Commands for Utility
  • CMD Commands for Troubleshooting
  • CMD Commands for Students
  • CMD Commands for Programmers

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'

  • Function: Displays the contents of the current directory.
  • How to use: Typedirand press Enter. Usedir /sto include subdirectories.
  • Use case: Quickly view files and folders in your current location.
Syntax: dir

2. Change Directories 'cd'

  • Function: Lets you navigate between folders.
  • How to use: Typecd [folder_name]to move into a directory. Usecd ..to go up one level.
  • Use case: Navigate to specific directories to manage files or execute commands
Syntax:cd [folder name]

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

  • Function: Allows you to create a new directory
  • How to use: Type mkdir [file_name]- Here the new directory name is GFG
  • Use case: When you need a new directory for any separate work, you may create a new directory
Syntax:mkdir [GFG]

4.Rename a File 'ren'

  • Function: Helps in renaming any file or directory.
  • How to use: Typeren or rename [old_name] [new_name]and press Enter.
  • Use case: Discover new method of renaming file or any directory.
Syntax:ren xyz.txt newxyz.txt

5. Delete a File 'del'

  • Function: Lets you to remove one or more files
  • How to use: Type del [file_name]- This will erase the provided file name
  • Use case: This function allows you to erase any file if you're unable to fetch
Syntax:del[file_name]

6. Close 'exit'

  • Function: Closes the Command Prompt window.
  • How to use: Typeexitand press Enter.
  • Use case: Ends your session with CMD.
Syntax:exit

7. Clear Screen 'cls'

  • Function: Clears all text from the CMD window.
  • How to use: Typeclsand press Enter.
  • Use case: Removes clutter after multiple commands
Syntax: cls

8.View Available Command 'help'

  • Function: Lists all available commands and their descriptions.
  • How to use: Typehelpand press Enter.
  • Use case: Discover new commands and learn their functions.
Syntax:help

9.Display or Set the System time 'time'

  • Function: Lets you set the system time or display the current time.
  • How to use: Typetime [new_time] and press Enter.
  • Use case: Allows the user to set their system's time without additional navigation
Syntax:time [new_time]

10.Copy Files 'copy'

  • Function: Lists all available commands and their descriptions.
  • How to use: Typecopy [source1] [destination2] and press Enter.
  • Use case: Discover new commands and learn their functions.
Syntax:copy file.txt Backup\
CommandDescriptionSyntaxExample
dirView the contents of a directorydirdir C:\Users\Documents
cdChange the current working directorycd [directory_name]cd Downloads
mkdirCreate a new directorymkdir [directory_name]mkdir NewProject
renRename a fileren [old_name] [new_name]ren draft.txt final.txt
delDelete a filedel [file_name]del unwanted.txt
exitClose the Command Promptexitexit
clsClear the Command Prompt screenclscls
helpView available CMD commands and their descriptionshelphelp
timeDisplay or set the system timetimetime 14:30:00
copyCopy files from one location to anothercopy [source] [destination]copy report.docx D:\Backup\

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'

  • Function: Scans and repairs corrupted system files.
  • How to use: Typesfc /scannowin CMD (run as administrator).
  • Use case: Fix system errors related to missing or corrupted files.
Syntax: sfc /scannow

2. Disk Error 'chkdsk'

  • Function: Scans the hard drive for bad sectors and file system errors.
  • How to use: Typechkdsk [drive letter]: /f(e.g.,chkdsk C: /f) in CMD.
  • Use case: Identify and fix disk issues.
Syntax: chkdsk C: /f

3. View Running Processor 'tasklist'

  • Function: Displays all running processes and their details.
  • How to use: Typetasklistto list processes. Usetasklist /fi "imagename eq [process name]"to filter.
  • Use case: Identify resource-heavy or unresponsive processes.
Syntax: tasklist /fi "imagename eq [process name]

4. Restart 'shutdown'

  • Function: Allows you to shut down or restart the computer via CMD.
  • How to use:
    • Shutdown:shutdown /s /f /t [seconds].
    • Restart:shutdown /r /f /t [seconds].
  • Use case: Automate shutdown or restart tasks
Syntax: Shutdown:shutdown /s /f /t [seconds].Restart:shutdown /r /f /t [seconds].

5. Network Statistics 'netstat'

  • Function: Displays active connections and listening ports.
  • How to use: Typenetstatto view all active connections.
  • Use case: Diagnose network-related issues or monitor network activity.
Syntax: netstat

6. Kill a Running Process 'taskkill'

  • Function: Lets you terminate a process using its process ID (PID)
  • How to use: Typetaskkill /[PID] /F to terminate
  • Use case: Can be helpful for terminating any dedicated PID.

Example (PID: 1124)

Syntax: taskkill /PID 11234 /F

7. View Saved Passwords 'netsh wlan show profiles'

  • Function: Retrieve the password of a saved Wi-Fi network.
  • How to use: Typenetsh wlan show profile name="WiFi-Name" key=clear
  • Use case: Discover new commands and learn their functions.
Example: netsh wlan show profile name="MyHomeWiFi" key=clear
CommandDescriptionSyntaxExample
sfcSystem File Checker - Scans and repairs system filessfc /scannowsfc /scannow
chkdskCheck Disk - Scans and fixes disk errorschkdsk [drive]: /f /rchkdsk C: /f /r
tasklistView running processestasklisttasklist
shutdownShutdown or restart the systemshutdown /r /t [seconds]shutdown /r /t 10 (Restart in 10 seconds)
netstatView network statistics and active connectionsnetstat -anetstat -an (Show all connections numerically)
taskkillKill a running process using its process ID (PID)taskkill /PID [PID] /Ftaskkill /PID 4567 /F (Kill process with ID 4567)
netsh wlan show profilesView saved Wi-Fi network namesnetsh wlan show profilesnetsh wlan show profiles

CMD Commands for Utility

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

1. Network Configuration 'ipconfig'

  • Function: Displays IP address, subnet mask, and gateway information.
  • How to use:
    • Basic: Typeipconfig.
    • Detailed: Typeipconfig /all.
  • Use case: Troubleshoot internet connectivity issues.
Syntax: ipconfig

2. Network Connectivity 'ping'

  • Function: Sends packets to test communication with another device or website.
  • How to use: Typeping [destination]
  • Use case: Check if a device or website is reachable.
Syntax: ping geeksforgeeks.org

3. System Information 'systeminfo'

  • Function: Displays detailed information about your computer.
  • How to use: Typesysteminfo.
  • Use case: Quickly access system specifications for troubleshooting or reporting.
Syntax: systeminfo

4. Trace Route 'tracert'

  • Function: Shows the path packets take to reach a specific destination.
  • How to use: Typetracert [destination]
  • Use case: Identify network bottlenecks or connectivity issues.
Syntax: tracert geeksforgeeks.org

5. Manage Drives 'diskpart'

  • Function: Opens a command-line utility for managing disk partitions.
  • How to use: Typediskpartto enter the disk management interface.
  • Use case: Create, delete, or modify partitions on your drives.
Syntax: diskpart

6.Delete a Directory 'rmdir'

  • Function: Removes directory from the origin
  • How to use: Typermdir [directory_name]and press Enter.
  • Use case: Discover new commands and learn their functions.

Example: GFG - Directory name

Syntax:rmdir GFG

7.View 'rmdir'

  • Function: Removes directory from the origin
  • How to use: Typermdir [directory_name]and press Enter.
  • Use case: Discover new commands and learn their functions.
Example: GFG - Directory name

8.Manage User Account 'net user'

  • Function: To list all the user accounts
  • How to use: Typenet user and press Enter.
  • Use case: Discover new commands and learn their functions.
Syntax: net user username password /add

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

  • Function: To check what programs launch on startup.
  • How to use: Typewmic startup get caption,command, and press Enter.
  • Use case: Discover new commands and learn their functions.
Syntax: wmic startup get caption,command
CommandDescriptionSyntaxExample
ipconfigView network configuration, including IP address, subnet mask, and gatewayipconfigipconfig /all (Displays detailed network info)
pingTest network connectivity by sending packets to a hostping [host or IP]ping google.com (Check connection to Google)
systeminfoDisplay detailed system information, including OS version, installed memory, and processorsysteminfosysteminfo
tracertTrace the route packets take to a network destinationtracert [hostname or IP]tracert google.com (View network path to Google)
diskpartManage disk partitions, including creating, formatting, and deleting partitionsdiskpartdiskpart → list disk → select disk 1 → create partition primary
rmdirDelete a directory (folder)rmdir [directory_name]rmdir /s /q OldFolder (Delete a folder and its contents without confirmation)
dirView contents of a directorydirdir C:\Users\Documents (List files in a specific directory)
net userManage user accounts, including adding, modifying, or deleting usersnet usernet user John password123 /add (Create a new user account)
wmic startup get caption,commandView startup programs and their commandswmic startup get caption,commandwmic startup get caption,command

CMD Commands for Troubleshooting

1. File Comparison 'fc'

  • Function: Compares two files and highlights differences.
  • How to use: Typefc [file1] [file2]to compare files.
  • Use case: Detect changes or errors in files
Syntax: fc 1 2

2. Advanced Network Diagnostics 'pathping'

  • Function: Combinespingandtracertfunctionalities to provide detailed network path diagnostics.
  • How to use: Typepathping [destination]
  • Use case: Troubleshoot complex network issues.
Syntax: pathping geeksforgeeks.org

3. Registry Editor 'regedit'

  • Function: Launches the Windows Registry Editor.
  • How to use: Typeregeditto open the registry.
  • Use case: Modify registry keys for advanced configuration or troubleshooting.
Syntax: regedit

4. View MAC 'getmac'

  • Function: Displays the MAC address of your network adapter.
  • How to use: Typegetmacto view the MAC address.
  • Use case: Identify your device's hardware address for network configurations
Syntax: getmac

5. Power Configuration 'powercfg'

  • Function: Displays and manages power settings.
  • How to use: Typepowercfg /[option]
  • Use case: Optimize power usage and troubleshoot battery issues.
Syntax: powercfg /energyfor a detailed power usage report

6. Enable Boot Manager 'bcdedit'

  • Function: Used to modify boot configuration settings
  • How to use: Typebcdedit / set current
  • Use case: Discover new commands and learn their functions.
Syntax: bcdedit /set {current} bootmenupolicy standard

7.Format a Drive 'format'

  • Function: To erase any specific drive.
  • How to use: Typeformat [drive]: /FS:NTFS and press Enter.
  • Use case: Discover new commands and learn their functions.
Syntax: format D: /FS:NTFS
CommandDescriptionSyntaxExample
fcCompare two files and highlight differencesfc [file1] [file2]fc file1.txt file2.txt (Compare two text files)
pathpingPerform advanced network diagnostics with packet loss detailspathping [destination]pathping google.com (Analyze network route to Google)
regeditOpen the Windows Registry Editor (GUI)regeditregedit (Opens the registry editor – use with caution!)
getmacDisplay the MAC (Media Access Control) address of your network adaptersgetmacgetmac /v /fo list (View MAC addresses in detailed format)
powercfgManage and analyze power configurationspowercfg /[option]powercfg /batteryreport (Generate a battery usage report)
bcdeditEnable, disable, or modify Windows Boot Configurationbcdedit /set {current} [option]bcdedit /set {current} bootmenupolicy standard (Enable boot menu in Windows 10/11)
formatFormat a drive (erase all data)format [drive]: /FS:[filesystem]format D: /FS:NTFS (Format drive D: with NTFS file system)

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'

  • Function: Opens the Windows Calculator application.
  • How to use: Typecalcand press Enter.
  • Use case: Quickly open the calculator for
Syntax: calc

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'

  • Function: Compiles Java source files into bytecode.
  • How to use: Typejavac [file name].javato compile Java code.
  • Use case: Compile and test Java programs directly from the command line.
Syntax: javac

2. Version Control 'git'

  • Function: Interacts with Git repositories from the command line.
  • How to use: Typegit [command]
  • Use case: Manage version control, clone repositories, or push commits from the command line.
Syntax: git clone [repository URL]

3. Execute Python Script 'python'

  • Function: Runs Python scripts in the command prompt.
  • How to use: Typepython [script.py]to execute a Python program.
  • Use case: Test and run Python code directly in the command line.
Syntax: python [script.py]

4. Run Node.js Scripts 'node'

  • Function: Executes Node.js scripts.
  • How to use: Typenode [script.js]to run a JavaScript file using Node.js.
  • Use case: Run backend scripts and test JavaScript programs in the command line.
Syntax: node [script.js]

5. Node Package Manager 'npm'

  • Function: Installs and manages JavaScript packages.
  • How to use: Typenpm install [package]to install a package.
  • Use case: Manage dependencies and libraries in Node.js applications.
Syntax: npm install [package]
CommandDescriptionSyntaxExample
javacCompile Java source code into bytecode (.class files)javac [filename].javajavac HelloWorld.java (Compile a Java file)
gitVersion control system for tracking changes in filesgit [command]git clone https://github.com/user/repo.git (Clone a repository)
pythonExecute a Python script or enter interactive modepython [script.py]python script.py (Run a Python script)
nodeExecute JavaScript code using Node.jsnode [script.js]node app.js (Run a Node.js script)
npmManage Node.js packages and dependenciesnpm [command]npm install express (Install the Express.js package)

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

Conclusion

Mastering the most useful CMD commands in Windows can empower you to perform tasks more efficiently, troubleshoot problems, and gain deeper control over your system. By familiarizing yourself with these essential CMD commands, you’ll be better equipped to handle a variety of situations, from simple file management to advanced system configurations. Whether you're a beginner or an experienced user, these commands are invaluable tools to have at your disposal.


Next Article

39 Windows CMD Commands for Everyone (2025 Updated)

P

patelajeet

Improve

Article Tags :

  • GBlog
  • Technical Scripter 2020
  • Command Prompt

Similar Reads

    Useful CMD Commands for Daily Use in Windows OS The Windows Command Prompt (CMD) is a powerful tool that many users overlook, but knowing a few useful CMD commands for Windows can make your daily tasks much more efficient. From navigating the file system to managing network settings, these daily use CMD commands can help streamline your workflow 3 min read How to Open Command Prompt in Windows 11, 10, 8, 7 The Command Prompt is a powerful tool in Windows for executing commands, troubleshooting issues, and automating tasks. Whether you're using Windows 11, 10, 8, or 7, this guide covers all the methods to open Command Prompt quickly and efficiently.Methods to Open Command Prompt in Windows in Any Versi 8 min read Top 12 Git Commands for Every Developer Git is a distributed version control system and open-source software. It enables developers to manage many versions of a source code with ease. You can use it to figure out who did what, when, and why. Git has become a must-have tool for any developer nowadays, and knowing Git commands is required f 9 min read CMD Commands to Gather Information of a System Command Prompt in Windows offers a range of commands to gather detailed information about your system's hardware, software, and overall health. These CMD commands provide quick access to system details, making it easier to diagnose issues, check specifications, and retrieve essential information. In 6 min read How to Use Command Prompt - Windows Command Prompt Guide Learn how to manually run the Command Prompt in different versions of Windows - The Windows Command Prompt (CMD) is a powerful tool that allows users to execute commands, automate tasks, and troubleshoot system issues efficiently. Whether you’re a beginner looking to learn basic CMD commands or an a 5 min read
39 Windows CMD Commands for Everyone (2025 Updated) - GeeksforGeeks (2025)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 6203

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.