List of CMD Commands for everyone, CMD Commands Cheat Sheet

CMD Commands List, CMD stands for command, which is sometimes known as Command Prompt or Window Command Processor informally. In this article, we will go through some popular CMD commands.

Updated: 03 Feb, 24 by Susith Nonis 19 Min

List of content you will read in this article:

Command Prompt, commonly called CMD, is a command-line interpreter for Windows. It allows us to carry out almost all kinds of tasks like networking, file handling, machine configuration, etc., from the terminal. This article will go through some popular CMD commands that will cover networking, file handling, and machine configuration.

CMD stands for command, which is sometimes known as Command Prompt or Window Command Processor informally. It is a command-line interpreter application for the Windows operating system that Microsoft develops.

It is used to carry out complex administrative duties such as managing system attributes, files, and users by executing commands input in the terminal. In other words, you can use CMD to control your operating system.

The Command Prompt, often referred to as CMD, offers significant utility in the world of computing. Its usefulness extends to a variety of scenarios, making it an essential tool for both novice and experienced users.

  • Automation of Tasks: One of the primary advantages of Command Prompt is its ability to automate tedious and repetitive tasks with ease. By scripting a sequence of commands, users can perform complex operations quickly, saving time and effort.
  • Sequential Command Execution: The Command Prompt allows users to execute multiple commands sequentially, one after the other. This sequential execution is particularly valuable when performing tasks that involve a series of steps or configurations.

Command Prompt, often called CMD, is a powerful tool in Windows that allows you to execute commands and perform various tasks. Opening CMD is a straightforward process, and there are multiple ways to do it. Don't miss out on advanced system commands – Follow our guide to Open Command Prompt as Administrator!

This section will guide you through two common methods to open Command Prompt on your Windows system.

Method 1: Using the Start Menu

  1. Click on the Windows Icon: Locate the Windows icon in the bottom-left corner of your screen (usually found in the taskbar). Click on it to open the Start Menu.
  2. Search for "cmd": In the search bar at the bottom of the Start Menu, type "cmd" (short for Command Prompt) and press "Enter" on your keyboard.
  3. Access Command Prompt: The search results will display "Command Prompt" or "cmd.exe." Click on it to open the Command Prompt window.

Method 2: Using Keyboard Shortcuts [CMD Shortcut]

If you prefer using keyboard shortcuts, you can access Command Prompt even more quickly.

  1. Press Windows Key + R: Simultaneously press the Windows key and the "R" key on your keyboard (Win + R). This action will open the "Run" dialog box.
  2. Type "cmd": In the "Run" dialog box, type "cmd" and press "Enter" or click "OK." This will launch the Command Prompt window.

Pro Tip: Run CMD as Administrator

In certain situations, you might need elevated privileges to execute specific commands or perform administrative tasks. To open Command Prompt as an administrator, follow these steps:

  1. Using the Start Menu: Search for "cmd" as mentioned in Method 1. However, instead of clicking on "Command Prompt," right-click on it.
  2. Choose "Run as administrator": A context menu will appear. Select "Run as administrator." If prompted for confirmation, click "Yes.

The Command Prompt (CMD) is a powerful tool in Windows that allows you to perform a wide range of tasks with just a few keystrokes. In this section, we'll delve into a comprehensive list of basic CMD commands, complete with their syntax and practical examples. These commands are essential for navigating and managing your system effectively.

CD (Change Directory)

  • Syntax: CD [/D] [drive:][path]
  • Example: C:> CD Prog

CD

Change Directory (CD) is used to navigate between folders or drives quickly. You can specify the directory you want to switch to, and the optional /D parameter lets you change both the drive and directory.

Mkdir (Make Directory)

  • Syntax: mkdir [<drive>:]<path>
  • Example: mkdir fantastic

mkdir

Mkdir allows you to create new directories or folders within existing directories. Simply provide the path to the new directory you want to create.

REN (Rename)

  • Syntax: ren [<drive>:][<path>]<filename1> <filename2>
  • Example: ren /?

ren

The Rename command (REN) is used to rename files. Provide the current filename followed by the desired new filename.

ASSOC (Fix File Associations)

  • Syntax: assoc [.ext[=[fileType]]]
  • Example: assoc .txt

assoc

ASSOC is crucial for managing file associations. It helps you link file extensions to specific programs, ensuring that, for instance, .txt files open with the correct text editor.

FC (File Compare)

  • Syntax: FC /a [/c] [/l] [/lb<n>] [/n] [/off[line]] [/t] [/u] [/w] [/<nnnn>] [<drive1>:][<path1>]<filename1> [<drive2>:][<path2 class="link-id">]<filename2>
  • Example: FC File1.txt File2.txt

FC

The File Compare (FC) command enables you to compare two files and identify differences. It can be useful for checking changes between versions of files.

POWERCFG (Power Configuration)

  • Syntax: powercfg /option [arguments] [/?]
  • Example: powercfg /?

powercfg

POWERCFG provides insights into your system's power settings and efficiency. It's invaluable for diagnosing power-related issues and optimizing power consumption.

SHUTDOWN (Turn off Computer)

  • Syntax: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/fw] [/f] [/m \computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
  • Example: shutdown /i

shutdown /i

SHUTDOWN offers control over your system's shutdown process. You can restart, shut down, or even plan shutdowns through the command line.

SYSTEMINFO (System Information)

  • Syntax: systeminfo [/s <computer> [/u <domain><username> [/p <password>]]] [/fo {TABLE | LIST | CSV}] [/nh]
  • Example: C:\Users\systeminfo

C:\Users\systeminfo

SYSTEMINFO provides a wealth of system-related information, including details about your operating system, network, and hardware.

SFC (System File Checker)

  • Syntax: SFC [/scannow] [/verifyonly] [/scanfile=<file>] [/verifyfile=<file>] [/offwindir=<offline windows directory> /offbootdir=<offline boot directory>]
  • Example: C:\Users\SFC

C:\Users\SFC

SFC helps detect and repair corrupted or missing system files. It's an essential tool for maintaining the integrity of your Windows installation.

NET USE (Map Drives)

  • Syntax: net use (drive name)\OTHER-COMPUTER\SHARE/persistent.yes
  • Example: net use /Persistent: Yes

net use /Persistent: Yes

NET USE simplifies the process of mapping network drives. You can create a mapped drive to a shared folder with this command.

These basic CMD commands are the building blocks for efficiently managing your Windows system from the command line. By mastering these commands, you'll be better equipped to navigate, configure, and troubleshoot your computer with ease.

In this section, we delve into a range of Best CMD commands tailored for networking purposes, empowering users to troubleshoot, configure, and analyze network-related issues effectively. These commands serve as indispensable tools for IT professionals and enthusiasts alike, aiding in everything from diagnosing connectivity problems to retrieving valuable network information. Below, we explore a selection of essential CMD network commands along with their syntax and primary functions:

IPCONFIG (IP Configuration)

  • Syntax: ipconfig [/all] [/renew [<adapter>]] [/release [<adapter>]] [/flushdns] [/displaydns] [/registerdns] [/showclassid <adapter>] [/setclassid <adapter> [<classID>]]
  • Purpose: Displays detailed network configuration information, including IP address, subnet mask, default gateway, and more.

ipconfig 

NETSTAT (Network Statistics)

  • Syntax: netstat [-a] [-b] [-e] [-n] [-o] [-p <Protocol>] [-r] [-s] [<interval>]
  • Purpose: Provides a snapshot of active network connections and protocol statistics, aiding in monitoring network performance and identifying issues.

netstat 

TRACERT (Trace Route)

  • Syntax: tracert [/d] [/h <maximumhops>] [/j <hostlist>] [/w <timeout>] [/R] [/S <srcaddr>] [/4] [/6] <targetname>
  • Purpose: Traces the route that packets take to reach a destination, displaying hop-by-hop information and helping pinpoint network latency or failures.

tracert 

PING (Send Test Packets)

  • Syntax: ping [/t] [/n <count>] [/l <size>] [/f] [/I <TTL>] [/v <TOS>] [/r <count>] [/s <count>] [/w <timeout>] [/R] [/S <Srcaddr>] [/4] [/6] <targetname>
  • Purpose: Sends ICMP echo requests to a target host, checking network connectivity and measuring response times.

ping 

PathPing

  • Syntax: pathping [/n] [/h <maximumhops>] [/g <hostlist>] [/p <Period>] [/q <numqueries>] [/w <timeout>] [/i <IPaddress>] [/4 <IPv4>] [/6 <IPv6>] [<targetname>]
  • Purpose: Combines the features of TRACERT and PING to provide a comprehensive analysis of network latency and packet loss along the route to a destination.

pathping 

GETMAC (Media Access Control)

  • Syntax: getmac[.exe][/s <computer> [/u <domain<user> [/p <password>]]][/fo {table | list | csv}][/nh][/v]
  • Purpose: Displays the MAC (Media Access Control) addresses of network adapters on a local or remote computer.

getmac

NSLOOKUP (Name Server Lookup)

  • Syntax: nslookup [-h HOST] [-p PORT] [-aCFHlLMmrRSVx] [-g SOURCE:FIRST-LAST] [-i ATTR] [-S SOURCE] [-T TYPE] object
  • Purpose: Retrieves domain name or IP address information by querying DNS servers, aiding in network troubleshooting and domain-related tasks.

nslookup 

NETSH (Network Shell)

  • Syntax: netsh [-a <Aliasfile>] [-c <Context>] [-r <Remotecomputer>] [-u [<domainname><username>] [-p <Password> | [{<NetshCommand> | -f <scriptfile>}]]
  • Purpose: Manages network settings, interfaces, and configurations, allowing users to fine-tune network parameters.

netsh 

ARP (Address Resolution Protocol)

  • Syntax: arp [/a [<inetaddr>] [/n <ifaceaddr>]] [/g [<inetaddr>] [-n <ifaceaddr>]] [/d <inetaddr> [<ifaceaddr>]] [/s <inetaddr> <etheraddr> [<ifaceaddr>]]
  • Purpose: Displays and manipulates the ARP cache, resolving IP addresses to MAC addresses and vice versa.

arp 

NBTSTAT

  • Syntax: nbtstat [/a <remotename>] [/A <IPaddress>] [/c] [/n] [/r] [/R] [/RR] [/s] [/S] [<interval>]
  • Purpose: Offers insights into NetBIOS over TCP/IP statistics, helping diagnose issues related to NetBIOS name resolution and connectivity.

nbtstat 

ATTRIB (Change File Attributes)

  • Syntax: ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [drive:][path][filename] [/S [/D]] Example: ATTRIB +R C:\example.txt
  • This command is used to change file attributes. +R sets the file as read-only, -R removes read-only status, +H makes the file hidden, etc.

ATTRIB 

ROBOCOPY (Robust File Copy)

  • Syntax: ROBOCOPY Source Destination [File][Options] Example: ROBOCOPY C:\source D:\destination /MIR
  • Robocopy is used for copying files and directories in a more advanced manner than the standard copy command. The /MIR option mirrors a directory.

ROBOCOPY 

DISKPART (Disk Partitioning Tool)

  • Syntax: DISKPART Example: After entering DISKPART, use LIST DISK to show all disks.
  • DISKPART is a powerful command-line utility for managing disk partitions, such as creating, deleting, and formatting partitions.

DISKPART

SFC (System File Checker)

  • Syntax: SFC [/SCANNOW] [/VERIFYONLY] [/SCANFILE=<file>] [/VERIFYFILE=<file>] [/OFFWINDIR=<offline windows directory> /OFFBOOTDIR=<offline boot directory>] Example: SFC /SCANNOW
  • SFC scans and repairs corrupted or missing system files. The /SCANNOW option scans the integrity of all protected system files and repairs files with problems when possible.

SFC

NETSTAT (Network Statistics)

  • Syntax: NETSTAT [-a] [-b] [-e] [-n] [-o] Example: NETSTAT -a
  • NETSTAT displays networking statistics and information about current TCP/IP connections. -a displays all connections and listening ports.

NETSTAT

CHKDSK (Check Disk)

  • Syntax: CHKDSK [drive:][[path]filename] [/F] [/R] [/X] Example: CHKDSK C: /F
  • CHKDSK checks the specified disk for structural integrity and fixes logical file system errors. The /F option fixes errors on the disk.

CHKDSK

GPUPDATE (Group Policy Update)

  • Syntax: GPUPDATE [/FORCE] [/LOGOFF] [/BOOT] [/SYNC] Example: GPUPDATE /FORCE
  • GPUPDATE refreshes Group Policy settings, applying any changes made. The /FORCE option forces all policies to be updated.

GPUPDATE

WMIC (Windows Management Instrumentation Command-line)

  • Syntax: WMIC [context] [where clause] [verb clause] Example: WMIC OS GET name
  • WMIC provides a command-line interface for Windows Management Instrumentation (WMI), allowing for querying and setting system information and configurations.

WMIC

BCDEDIT (Boot Configuration Data Editor)

  • Syntax: BCDEDIT [/set] [id] [property] [value] Example: BCDEDIT /set {current} bootstatuspolicy ignoreallfailures
  • BCDEDIT manages boot configuration data, useful for troubleshooting startup issues and configuring boot settings.

BCDEDIT

TASKLIST (List Processes)

  • Syntax: TASKLIST [/S system] [/U username] [/P password] [/M [module]] [/SVC] [/V] [/FI filter] [/FO format] [/NH] Example: TASKLIST /FI "IMAGENAME eq notepad.exe"
  • TASKLIST displays a list of currently running processes, similar to the information available in Task Manager but accessible via CMD.

TASKLIST

NET USER (User Account Management)

  • Syntax: NET USER [username [password | *] [options]] [/DOMAIN] Example: NET USER administrator *
  • Manages user accounts on the computer. For example, this command can reset the administrator's password.

NET USER

NET LOCALGROUP (Local Group Management)

  • Syntax: NET LOCALGROUP [groupname [/COMMENT:"text"]] [/DOMAIN] Example: NET LOCALGROUP Administrators John /ADD
  • Adds or removes users from local groups. In the example, the user John is added to the local Administrators group.

NET LOCALGROUP

GPRESULT (Display Group Policy Information)

  • Syntax: GPRESULT [/S system] [/U username] [/P [password]] [/SCOPE scope] [/USER targetusername] [/R | /V | /Z] Example: GPRESULT /R
  • Displays Group Policy settings and Resultant Set of Policy (RSoP) for a user or a computer.

GPRESULT

SC (Service Control)

  • Syntax: SC [command] [service_name] [options] Example: SC queryex type= service state= all
  • Manages Windows services. This example queries the status of all services on the system.

SC

NETSH (Network Configuration Tool)

  • Syntax: NETSH [context] command | -f scriptfile Example: NETSH wlan show profiles
  • Displays or modifies the network configuration of a computer. The example lists all wireless network profiles.

NETSH

ICACLS (Change File and Folder Permissions)

  • Syntax: ICACLS name /reset /T /C /L /Q Example: ICACLS C:\windows\* /reset /T
  • Resets the permissions of files and folders. In the example, it recursively resets permissions for all files in the C:\Windows directory.

ICACLS

SHUTDOWN (Shutdown or Restart Computer)

  • Syntax: SHUTDOWN [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computer] [/t xxx] [/d [p|u:]xx:yy [/c "comment"]] Example: SHUTDOWN /r /t 0
  • Shuts down or restarts the computer. The example command restarts the computer immediately.

SHUTDOWN

DISM (Deployment Image Servicing and Management)

  • Syntax: DISM /Online /Cleanup-Image /RestoreHealth Example: DISM /Online /Cleanup-Image /RestoreHealth
  • Repairs and prepares Windows images, including the Windows Recovery Environment, Windows Setup, and Windows PE. The example command repairs the Windows image.

DISM

NETSTAT (Network Statistics)

  • Syntax: NETSTAT [-a] [-b] [-e] [-n] [-o] Example: NETSTAT -ano
  • Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for IPv4), and IPv6 statistics (for IPv6).

NETSTAT

TASKKILL (Terminate Tasks by Process ID or Image Name)

  • Syntax: TASKKILL [/S system] [/U username] [/FI filter] [/PID processid | /IM imagename] [/T] [/F] Example: TASKKILL /IM notepad.exe /F
  • Ends one or more tasks or processes. The example command forcefully terminates all instances of Notepad.

TASKKILL

These administrative commands provide powerful tools for managing and configuring Windows systems directly from the command line.

Mastering Command Prompt (CMD) can be greatly enhanced by leveraging some handy tricks that not only streamline your workflow but also make your interaction with the command line more efficient. Below, we'll explore several CMD command tricks that can help you become a more proficient user:

  1. Command History: CMD retains a history of previously entered commands. You can easily recall these commands by using the "doskey/history" trick. Pressing the "Up" arrow key also allows you to cycle through your command history, making it convenient to revisit or reuse previous commands.
  2. Run Multiple Commands: Save time by running multiple commands consecutively. Separate each command with "&&" to execute them sequentially. For example, "assoc.txt && IPCONFIG" will run the commands one after the other.
  3. Function Keys and Their Usage: CMD provides a set of function keys that can be incredibly helpful. For instance, pressing the "F7" key displays a list of previously executed commands, making it easy to select and rerun them. Experiment with function keys to discover other time-saving shortcuts.
  4. Send Output to Clipboard: Instead of copying and pasting command output, you can pipe the result directly to the Windows clipboard. For instance, using "Assoc.txt | clip" will copy the output of the "Assoc.txt" command to your clipboard, allowing you to paste it wherever needed.
  5. Abort a Command: If you accidentally initiate a command or need to stop a process, you can abort it by pressing "CTRL+C." This simple shortcut can save you from waiting for a command to complete or prevent an unintended action.

List of CMD Commands for everyone, CMD Commands Cheat Sheet

This article has delved into the world of CMD commands in Windows, offering a comprehensive overview of their functionalities and applications. We've covered a wide array of basic, network-related, and advanced CMD commands, along with insightful CMD command tricks. CMD commands are the backbone of Windows system management, providing users with a robust toolkit to interact with the operating system efficiently.

As you continue to explore CMD commands and their practical usage, you'll discover their versatility and potential to streamline tasks and solve problems. Whether you're a novice or an experienced user, the world of CMD commands in Windows is ripe for exploration, offering endless possibilities for optimizing your computing experience.

To get a list of commands in CMD, simply type "help" and press Enter. This will display a list of available commands and their brief descriptions.

To use a CMD command, type the command followed by any necessary arguments or options, and then press Enter. For example, to list files in a directory, you can use the "dir" command like this: "dir C:\foldername".

To learn CMD programming, you can start by exploring online tutorials, books, and resources dedicated to Windows command-line scripting. Practice by writing and running batch scripts (files with a .bat extension) to automate tasks.

To install an executable (exe) file using CMD, navigate to the directory containing the exe file in CMD using the "cd" command. Then, simply type the name of the exe file and press Enter. For instance, if the exe file is "installer.exe," you can install it by typing "installer.exe" and pressing Enter.

CMD is a basic command-line tool for simple tasks and scripts, while PowerShell is more powerful, supporting complex scripts and system administration with access to the .NET framework. Use CMD for legacy scripts and simple commands; use PowerShell for advanced scripting and automation.

To redirect command output to a file in CMD, use the > operator to overwrite a file or >> to append to it. Example to save output: ipconfig > output.txt to overwrite, or ipconfig >> output.txt to append. Use 2> to redirect error messages specifically.

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.