26 Windows CMD Commands for Everyone (2024 Updated)
Last Updated :
26 Nov, 2024
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: Type
dir and press Enter. Use dir /s to 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: Type
cd [folder name] to move into a directory. Use cd .. to go up one level.
- Use case: Navigate to specific directories to manage files or execute commands
Syntax: cd [folder name]
3. Close ‘exit’
- Function: Closes the Command Prompt window.
- How to use: Type
exit and press Enter.
- Use case: Ends your session with CMD.
Syntax: exit
4. Clear Screen ‘cls’
- Function: Clears all text from the CMD window.
- How to use: Type
cls and press Enter.
- Use case: Removes clutter after multiple commands
Syntax: cls
5. View Available Command ‘help’
- Function: Lists all available commands and their descriptions.
- How to use: Type
help and press Enter.
- Use case: Discover new commands and learn their functions.
Syntax: help
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: Type
sfc /scannow in 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: Type
chkdsk [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: Type
tasklist to list processes. Use tasklist /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: Type
netstat to view all active connections.
- Use case: Diagnose network-related issues or monitor network activity.
Syntax: netstat
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: Type
ipconfig.
- Detailed: Type
ipconfig /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: Type
ping [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: Type
systeminfo.
- 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: Type
tracert [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: Type
diskpart to enter the disk management interface.
- Use case: Create, delete, or modify partitions on your drives.
Syntax: diskpart
CMD Commands for Troubleshooting
1. File Comparison ‘fc’
- Function: Compares two files and highlights differences.
- How to use: Type
fc [file1] [file2] to compare files.
- Use case: Detect changes or errors in files
Syntax: fc 1 2
2. Advanced Network Diagnostics ‘pathping’
- Function: Combines
ping and tracert functionalities to provide detailed network path diagnostics.
- How to use: Type
pathping [destination]
- Use case: Troubleshoot complex network issues.
Syntax: pathping geeksforgeeks.org
3. Registry Editor ‘regedit’
- Function: Launches the Windows Registry Editor.
- How to use: Type
regedit to 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: Type
getmac to 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: Type
powercfg /[option]
- Use case: Optimize power usage and troubleshoot battery issues.
Syntax: powercfg /energy for a detailed power usage report
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: Type
calc and 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: Type
javac [file name].java to 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: Type
git [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: Type
python [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: Type
node [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: Type
npm install [package] to install a package.
- Use case: Manage dependencies and libraries in Node.js applications.
Syntax: npm install [package]
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.
Windows CMD Commands for Everyone – FAQ’s
How do I open Command Prompt in Windows?
Use the Windows search bar, type cmd, and press Enter. Alternatively, press Windows + R, type cmd, and hit Enter.
How can I manage files using CMD?
Use commands like cd (change directory), mkdir (create directory), del (delete files), and copy (copy files).
How do I clear my DNS cache?
Run ipconfig /flushdns to clear the DNS cache.
How can CMD commands help with troubleshooting in Windows?
CMD commands like ipconfig for checking network configuration, chkdsk for scanning and fixing disk errors, and sfc /scannow for repairing system files are among the best CMD commands for Windows troubleshooting.
Are there any CMD commands that every Windows user should know?
Yes, commands like ping for testing network connectivity, tasklist for viewing running processes, and shutdown for turning off or restarting the computer are CMD commands every Windows user should know.
What are some advanced CMD commands in Windows?
Advanced CMD commands in Windows include netstat for network statistics, diskpart for disk management, and robocopy for robust file copying. These commands offer more control over system operations and configurations.
How can I learn more about CMD commands and their usage?
You can learn more about Windows command prompt commands by typing help in the Command Prompt, which provides a list of available commands along with a brief description of each. Additionally, online resources and tutorials can offer deeper insights.
Similar Reads
Provide some example of config file separation for dev and prod Environments
Config files are used to store the URLs, environment-related credentials, etc for our application. In order to access the config files it is better to install the https://www.npmjs.com/package/dotenv npm package and place it in the root file where your application starts. This is used to detect if a
2 min read
How to Create a New Branch on GitHub using Android Studio?
Creating a new branch on GitHub using Android Studio can help your development workflow by allowing you to work on new features or fixes without affecting the main codebase. In this article, we will walk you through the steps to create a new branch directly from Android Studio and push it to your Gi
2 min read
How to use ReactJS with HTML Template ?
We all know ReactJS is a front-end development framework. For the front end, we need to create HTML templates. So, this article teaches you how to use HTML templates in ReactJS. The process is very simple. Prerequisites:NodeJS or NPMReact JSApproach: We will create a simple one-page HTML template in
4 min read
How to Hide Contacts on iPhone?
Quick Solution!Here is a quick solution for our active and speedy learners. Follow these steps to hide contacts on iPhones. Group Contacts:Create a contact group in the Contacts app.Save contacts to the group and delete them from the main account.Save to Google Contacts:Backup contacts to the Google
7 min read
Types of Search Engine Optimization (SEO)
Search Engine Optimization (SEO) is a set of practices and techniques that focus on increasing a website's visibility and ranking in search engine results. But when you dive into SEO or Search Engine Optimization, you will come across several kinds of SEO claiming to be types of SEO, which can be ov
15+ min read
How to Obtain Values of Request Variables in Flask
In this article, we will see how to request the query arguments of the URL and how to request the incoming form data from the user into the flask. In a flask, to deal with query strings or form data, we use Request variables. For example, a query string may look like this: google.com/search?q=python
4 min read
Create a string with unique characters from the given N substrings
Given an array arr[] containing N substrings consisting of lowercase English letters, the task is to return the minimum length string that contains all given parts as a substring. All characters in this new answer string should be distinct. If there are multiple strings with the following property p
11 min read
Difference between copying an object through assignment operator and _.clone() function ?
There are two ways, we can copy the object in javascript, first is by using the assignment operator i.e. '=' and the second is by using the 'clone' function. In this article, we'll discuss what is the difference between both of them. By using the _.clone() function: Both of these methods copy object
2 min read
History of Operating System
An operating system is a type of software that acts as an interface between the user and the hardware. It is responsible for handling various critical functions of the computer and utilizing resources very efficiently so the operating system is also known as a resource manager. The operating system
8 min read
How to Specify Optional Properties in TypeScript?
TypeScript is a powerful programming language that extends JavaScript by adding optional static typing and class-based object-oriented programming. One of the key features of TypeScript is the ability to specify optional properties in interfaces and classes, providing flexibility to our object types
3 min read
Interact with files in Python
Python too supports file handling and allows users to handle files i.e., to read, write, create, delete and move files, along with many other file handling options, to operate on files. The concept of file handling has stretched over various other languages, but the implementation is either complica
6 min read
TCD (Task-centered system design)
Task-Centered system design A variant of user-centered design, task-centered system design, is a technique that allows developers to design and evaluate interfaces based on users' real-world tasks. As part of the design, this becomes a requirements analysis (requirements are the tasks to be performe
6 min read
Software Testing - Multi-tenancy Testing
In software development, multi-tenancy refers to the ability of a software application or service to support multiple tenants or customers, each with its own unique data and configurations, on a single instance or deployment of the software. Multi-tenancy is often used in software as a service (SaaS
15+ min read
Write to a File From the Shell
Writing files in the shell might sound complex, but it's simple, and once you understand it will be at your fingertips. Whether you're saving data, creating files, or editing existing ones, here's a simple guide to help you with file writing in the shell. This article makes you aware of everything a
3 min read
What's new in Bootstrap v4.3 ?
The front end web development track consists of several languages, frameworks, and libraries. HTML, CSS, JavaScript, jQuery, AngularJS, ReactJS, VueJS, Bootstrap are some of those. These are some of the technologies that a developer must know in order to make beautiful, responsive, and functional we
4 min read
Flutter - Slider with Gradient
In this article, we will create a slide to confirm the button using the widget in Flutter. A sample video is given below to get an idea about what we are going to do in this article. [video mp4="https://media.geeksforgeeks.org/wp-content/uploads/20221225191607/slidegradient-2022-12-25-19-09-01.mp4"]
3 min read
Angular PrimeNG Table ContextMenu
Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
6 min read
GeeksforGeeks Community - Connect, Ask, Learn & Grow with Tech Geeks
In the modern era of online learning, hybrid work environments, and intense competition, college students struggle to choose the right computer science career path, Smart tech grads with big dreams face limited opportunities or uninspiring jobs and Working professionals grapple with job switches and
5 min read
Best 5 AWS Alternatives in 2023
If you are looking for cloud computing services then you must have heard of Amazon Web Services (AWS). It is the world's most famous cloud service provider and broadly adopted cloud platform offering over 200 fully featured services from data centers globally. It offers virtualization technology, cl
5 min read