- A-Z Windows CMD Commands List
- Windows cmd list all commands
- Syntax
- Parameters
- Remarks
- 21 CMD Commands All Windows Users Should Know
- 1. ASSOC: Fix File Associations
- 2. FC: File Compare
- 3. IPCONFIG: IP Configuration
- 4. NETSTAT: Network Statistics
- 5. PING: Send Test Packets
- 6. TRACERT: Trace Route
- 7. POWERCFG: Power Configuration
- 8. SHUTDOWN: Turn Off Computer
- 9. SYSTEMINFO: System Information
- 10. SFC: System File Checker
- 11. NET USE: Map drives
- 12. CHKDSK: Check Disk
- 13. SCHTASKS: Schedule Tasks
- 14. ATTRIB: Change File Attributes
- Other Windows CMD Commands
A-Z Windows CMD Commands List
Do you want to know every CMD command for Windows? Find it here
Windows Command Prompt is an often ignored aspect of the modern Windows OSes.
The command prompt, also known as cmd.exe or cmd is a command-line interpreter available since the NT line of the Windows operating system.
While the majority of reasons for which the command prompt was used for can now be done through a graphical interface, this application has remained with Windows and is still used by many.
Although many of us might not have used them, the fact that they still exist in modern-day Windows is reason enough for us to be familiar with them.
While the commands in Windows 10, 8, 7, Vista, and XP are called CMD commands or Command Prompt commands, the commands in Windows 98/95 and MS-DOS are called DOS commands.
In this article, we have listed the most commonly used commands in Windows operating systems.
But before we move further, we will see how to open the Command Prompt program in Windows. This can be done in four ways:
Method 1: Open the program in Start Menu
Click the lower-left Start button to open the Start Menu, type cmd in the empty box and tap Command Prompt in the results.
Method 2: Turn on Command Prompt by search.
Tap the Search button on the taskbar, type cmd in the search box and choose Command Prompt on the top.
Method 3: Open Command Prompt from Quick Access Menu.
Press Windows+X, or right-click the bottom-left corner to open the menu, and then select Command Prompt on it.
Method 4: Open the app through Run.
Open the Run dialog using Windows+R hotkeys, enter cmd and tap OK.
Since now we know how to open the Command prompt screen,
Windows cmd list all commands
Starts a new instance of the command interpreter, Cmd.exe. If used without parameters, cmd displays the version and copyright information of the operating system.
Syntax
Parameters
Parameter | Description |
---|---|
/c | Carries out the command specified by string and then stops. |
/k | Carries out the command specified by string and continues. |
/s | Modifies the treatment of string after /c or /k. |
/q | Turns the echo off. |
/d | Disables execution of AutoRun commands. |
/a | Formats internal command output to a pipe or a file as American National Standards Institute (ANSI). |
/u | Formats internal command output to a pipe or a file as Unicode. |
/t: < | > | Sets the background (b) and foreground (f) colors. |
/e:on | Enables command extensions. |
/e:off | Disables commands extensions. |
/f:on | Enables file and directory name completion. |
/f:off | Disables file and directory name completion. |
/v:on | Enables delayed environment variable expansion. |
/v:off | Disables delayed environment variable expansion. |
Specifies the command you want to carry out. | |
/? | Displays help at the command prompt. |
The following table lists valid hexadecimal digits that you can use as the values for and :
Value | Color |
---|---|
0 | Black |
1 | Blue |
2 | Green |
3 | Aqua |
4 | Red |
5 | Purple |
6 | Yellow |
7 | White |
8 | Gray |
9 | Light blue |
a | Light green |
b | Light aqua |
c | Light red |
d | Light purple |
e | Light yellow |
f | Bright white |
Remarks
To use multiple commands for , separate them by the command separator && and enclose them in quotation marks. For example:
If you specify /c or /k, cmd processes, the remainder of string, and the quotation marks are preserved only if all of the following conditions are met:
You don’t also use /s.
You use exactly one set of quotation marks.
You don’t use any special characters within the quotation marks (for example: & ( ) @ ^ | ).
You use one or more white-space characters within the quotation marks.
The string within quotation marks is the name of an executable file.
If the previous conditions aren’t met, string is processed by examining the first character to verify whether it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved.
If you don’t specify /d in string, Cmd.exe looks for the following registry subkeys:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_EXPAND_SZ
If one or both registry subkeys are present, they’re executed before all other variables.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
You can disable command extensions for a particular process by using /e:off. You can enable or disable extensions for all cmd command-line options on a computer or user session by setting the following REG_DWORD values:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD
Set the REG_DWORD value to either 0Г—1 (enabled) or 0Г—0 (disabled) in the registry by using Regedit.exe. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
When you enable command extensions, the following commands are affected:
assoc
call
chdir (cd)
color
del (erase)
endlocal
for
ftype
goto
if
mkdir (md)
popd
prompt
pushd
set
setlocal
shift
start (also includes changes to external command processes)
If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.
File and directory name completion is not enabled by default. You can enable or disable file name completion for a particular process of the cmd command with /f:<on | off>. You can enable or disable file and directory name completion for all processes of the cmd command on a computer or for a user logon session by setting the following REG_DWORD values:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD
To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0Г—9 is TAB and 0Г—08 is BACKSPACE). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
If you enable file and directory name completion by using /f:on, use CTRL+D for directory name completion and CTRL+F for file name completion. To disable a particular completion character in the registry, use the value for white space [0Г—20] because it is not a valid control character.
Pressing CTRL+D or CTRL+F, processes the file and directory name completion. These key combination functions append a wildcard character to string (if one is not present), builds a list of paths that match, and then displays the first matching path.
If none of the paths match, the file and directory name completion function beeps and does not change the display. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. The only difference between the key combinations CTRL+D and CTRL+F is that CTRL+D only matches directory names and CTRL+F matches both file and directory names. If you use file and directory name completion on any of the built-in directory commands (that is, CD, MD, or RD), directory completion is assumed.
File and directory name completion correctly processes file names that contain white space or special characters if you place quotation marks around the matching path.
You must use quotation marks around the following special characters: & [ ] | < >^ = ; ! ‘ + , `
If the information that you supply contains spaces, you must use quotation marks around the text (for example, «Computer Name»).
If you process file and directory name completion from within string, any part of the path to the right of the cursor is discarded (at the point in string where the completion was processed).
21 CMD Commands All Windows Users Should Know
So you can have more control over your PC
The Windows command prompt is a feature that’s been a core part of the Windows operating system for a long time. There are some CMD commands that are so useful and easy to use that even regular users see the Windows command prompt as a key part of the operating system.
There are always rumors that it will be phased out at some point, but that’s unlikely to happen any time soon.
The following are 21 of the best CMD commands you should know if you want to have more control over your Windows PC.
1. ASSOC: Fix File Associations
One of the most powerful tools in the CMD command library is the ASSOC command.
Your computer associates certain file extensions with certain programs. This is how your computer knows to open Adobe when you double click a PDF file, or Microsoft Word when you double click a DOC file.
You can view all the file associations your computer knows about by typing ASSOC in the command window. You’ll see the file extension and the program it’s associated with.
You can set the association by typing something like assoc .doc=Word.Document.8.
2. FC: File Compare
Sometimes when files are changed over time, it’s hard to remember what the differences were between versions. You may not know that a CMD command offers the ability to compare files and see all differences, but it’s true.
The FC command performs either an ascii or a binary file comparison and will list all of the differences that it finds.
Fc /a File1.txt File2.txt will compare two ascii files.
Fc /b Picture1.jpg Picture2.jpg will do a binary compare on two images.
3. IPCONFIG: IP Configuration
Network troubleshooting is never simple, but one command that makes it much easier is IPCONFIG.
Using this command in the CMD command prompt returns detailed information about your current network adapter connection including:
- Current IP Address
- Subnet Mask
- Default Gateway IP
- Current domain
This information can help you troubleshoot router issues and other connection issues you could be having with your network adapter.
4. NETSTAT: Network Statistics
Concerned that you could have malware running on your computer that’s connecting to internet locations without you knowing about it?
If you run a NETSTAT command in the command prompt, you can get a list of all active TCP connections from your computer.
5. PING: Send Test Packets
An IT Analyst’s best friend is the PING command. Running this command sends test packets over the network to the target system.
You can use the PING command to test whether your computer can access another computer, a server, or even a website. It can help with revealing network disconnections. It also provides transit time for the packets in milliseconds, so it also reveals a bad network connection as well.
6. TRACERT: Trace Route
TRACERT is a fascinating Windows Command to use. If you’re ever curious to see the path your internet traffic takes to get from your browser to a remote system like Google servers, you can use TRACERT to see it.
The command stands for “Trace Route”, which sends packets out to a remote destination (server or website), and provides you with all of the following information:
- Number of hops (intermediate servers) before getting to the destination
- Time it takes to get to each hop
- The IP and sometimes the name of each hop
TRACERT can reveal how the routes of your internet requests change depending where you’re accessing the web. It also helps with troubleshooting a router or switch on a local network that may be problematic.
7. POWERCFG: Power Configuration
Are you frustrated with how quickly your laptop seems to run out of power? It could be that your power settings are configured as efficiently as possible. There’s a windows CMD command called POWERCFG (power configuration) that can help. Run the command prompt as an administrator and type powercfg – energy to get a full power efficiency report.
The process can take up to about a minute, but when it’s done, you’ll see whether there are any warnings or errors that might help you improve the power efficiency of your system.
View the energy-report.html file to see the details of those errors and warnings.
8. SHUTDOWN: Turn Off Computer
The SHUTDOWN command is a pretty versatile command that lets you shutdown the computer but control the behavior of that shutdown. It’s commonly used as a scheduled task or part of an IT batch job after patches have been applied to a computer system.
Typing shutdown /i from the command prompt will initiate a shutdown, but it’ll upon a GUI to give the user an option on whether to restart or do a full shutdown. If you don’t want to have any GUI pop up, you can just issue a shutdown /s command.
There is a long list of other parameters you can use to do a log off, hibernate, restart, and more. Just type shutdown without any arguments to see them all.
9. SYSTEMINFO: System Information
If you need to know what brand of network card you have, processor details, or the exact version of your Windows OS, the SYSTEMINFO command can help.
This command polls your system and pulls the most important information about your system. It lists the information in a clean format that’s easy to read.
10. SFC: System File Checker
If you’re ever concerned that a virus or some other software might have corrupted your core system files, there’s a Windows command that can scan those files and ensure their integrity.
You need to launch CMD as administrator (right click and choose Run as Administrator). Typing SFC /SCANNOW will check the integrity of all protected system files. If a problem is found, the files will be repaired with backed-up system files.
The SFC command also lets you:
- /VERIFYONLY: Check the integrity but don’t repair the files.
- /SCANFILE: Scan the integrity of specific files and fix if corrupted.
- /VERIFYFILE: Verify the integrity of specific files but don’t repair them.
- /OFFBOOTDIR: Use this to do repairs on an offline boot directory.
- /OFFWINDIR: Use this to do repairs on an offline Windows directory.
- /OFFLOGFILE: Specify a path to save a log file with scan results.
The scan can take up to 10 or 15 minutes, so give it time.
11. NET USE: Map drives
If you want to map a new drive, you could always open File Explorer, right click on This PC, and go through the Map Network Drive wizard. However, using the NET USE command, you can do the same thing with one command string.
For example, if you have a share folder on a computer on your network called \\OTHER-COMPUTER\SHARE\, you can map this as your own Z: drive by typing the command:
Net use Z: “\\OTHER-COMPUTER\SHARE” /persistent:yes
The persistent switch tells your computer that you want this drive remapped every time you log back into your computer.
12. CHKDSK: Check Disk
While the SFC command only checks the integrity of core system files, you can use the CHKDSK command to scan an entire drive.
The command to check the C: drive and repair any problems, launch the command window as an administrator and type CHKDSK /f C:.
This command checks for things like:
- File fragmentation
- Disk errors
- Bad sectors
The command can fix any disk errors (if possible). When the command is finished, you’ll see a status of the scan and what actions were taken.
13. SCHTASKS: Schedule Tasks
Windows comes with a wizard for creating scheduled tasks. For example, maybe you have a BAT file stored on C:\temp that you want to run every day at noon.
You’d have to click through the Scheduled Task wizard to configure this. Or you can type a single SCHTASKS command to set it up.
SCHTASKS /Create /SC HOURLY /MO 12 /TR Example /TN c:\temp\File1.bat
The scheduled switch accepts arguments like minute, hourly, daily, and monthly. Then you specify the frequency with the /MO command.
If you typed the command correctly, you’ll see the response, SUCCESS: The scheduled task “Example” has successfully been created.
14. ATTRIB: Change File Attributes
In Windows, you can change file attributes by right clicking on a file and finding the right property to change. However, instead of hunting around for the file attribute, you can use the ATTRIB command to set the file attributes.
For example, if you type: ATTRIB +R +H C:\temp\File1.bat, it’ll set File1.bat as a hidden, read-only file.
There is no response when it’s successful, so unless you see an error message, the command worked.
Other Windows CMD Commands
As you can see, there are some powerful and useful things you can do with the Windows command prompt, if you know the right commands.
Believe it or not, there are even more commands that will give you the ability to do some things you probably never realized just by typing a simple command.
- BITSADMIN: Initiate upload or download jobs over the network or internet and monitor the current state of those file transfers.
- COLOR: Change the background color of the command prompt window.
- COMP: Compare the contents of any two files to see the differences.
- FIND/FINDSTR: Search for strings inside of any ASCII files.
- PROMPT: Change the command prompt from C:\> to something else.
- TITLE: Change the title of the command prompt window.
- REGEDIT: Edit keys in the Windows registry (use with caution).
- ROBOCOPY: A powerful file copy utility built right into Windows.
If you’re interested in learning more, Microsoft offers a full list of all of the Windows CMD commands included in the latest version of the Windows OS.
Ryan has been writing how-to and other technology-based articles online since 2007. He has a BSc degree in Electrical Engineering and he’s worked 13 years in automation engineering, 5 years in IT, and now is an Apps Engineer. Read Ryan’s Full Bio