All supported versions of Windows and Windows Server have a set of Win32 console commands built in. This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.
Windows has two command-line shells: the Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.
The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host, you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all commands that are available at the command line.
PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run both Windows Commands and PowerShell cmdlets in PowerShell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.
For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.
A reference of exit and error codes for Windows Commands can be found in the Debug system error codes articles that may be helpful to understanding errors produced.
Command Prompt can be found in the Start menu or Apps screen.
Alternatively, use the Run command cmd, or open from its original location: C:\Windows\system32\cmd.exe.
Command shell file and directory name automatic completion
You can configure the Command shell to automatically complete file and directory names on a computer or user session when a specified control character is pressed. By default this control character is configured to be the tab key for both file and directory names, although they can be different. To change this control character, run
regedit.exe and navigate to either of the registry keys and entries below, depending on whether you wish to change the value for the current user only, or for all users of the computer.
To use, enter a valid Command Prompt command.
Command Prompt is a command line interpreter application available in most Windows operating systems. It's used to execute entered commands.
Set these values to that of the control character you wish to use. See virtual key codes for a complete list. To disable a particular completion character in the registry, use the value for space (0x20) as it is not a valid control character. The type of value for this registry entry is REG_DWORD, and can be specified by hexadecimal or decimal value.
You can also enable or disable file and directory name completion per instance of a Command shell by running
cmd.exe with the parameter and switch
/F:OFF. If name completion is enabled with the
/F:ON parameter and switch, the two control characters used are
Ctrl-D for directory name completion and
Ctrl-F for file name completion. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Command-line reference A-Z
To find information about a specific command, in the following A-Z menu, select the letter that the command starts with, and then select the command name.
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
- Most of those commands automate tasks via scripts and batch files, perform advanced administrative functions, and troubleshoot or solve certain kinds of Windows issues.
- Command Prompt is officially called Windows Command Processor, but it's also sometimes referred to as the command shell orcmd prompt, or even by its filename, cmd.exe.
- Command Prompt is sometimes incorrectly referred to as "the DOS prompt" or as MS-DOS.
- Command Prompt is a Windows program that emulates many of the command line abilities available in MS-DOS, but it's not MS-DOS.
- Yet another method for opening Command Prompt in some versions of Windows is through the Power User Menu.
- However, you might see PowerShell there instead of Command Prompt depending on how your computer is set up.
- You can switch between Command Prompt and PowerShell from the Win+X menu.
- Many commands can only be executed if you're running the Command Prompt as an administrator.
- To use Command Prompt, you enter a valid Command Prompt command along with any optional parameters.
- Command Prompt then executes the command as entered and performs the task or function it's designed to perform in Windows.
- For example, executing the following Command Prompt command in your Downloads folder would remove all MP3s from that folder:.
- Commands must be entered into Command Prompt exactly.
- The wrong syntax or a misspelling could cause the command to fail or worse; it could execute the wrong command or the right command in the wrong way.
- A comfort level with reading command syntax is recommended.
- For example, executing the dir command will show a list of files and folders that exist at any specific location on the computer, but it doesn't actually do anything.
- However, change just a couple letters and it turns into the del command, which is how you delete files from Command Prompt!
- Syntax is so important that with some commands, especially the delete command, adding even a single space can mean deleting entirely different data.
- Here's an example where the space in the command breaks the line into two sections, essentially creating two commands where the files in the root folder (files) are deleted instead of the files in the subfolder (music):.
- The proper way to execute that command so as to remove files from the music folder instead is to remove the space so that the whole command is strung together correctly.
- Don't let this scare you away from using Command Prompt commands, but definitely let it make you cautious.
- A large number of commands exist in Command Prompt, but command availability varies across Microsoft Operating Systems.
- Command Prompts for Windows Operating Systems:.
- All Windows Command Prompt Commands.
- There are lots and lots of commands you can use in Command Prompt, but not all of them are used as often as others.
- Here are some of the more commonly used Command Prompt commands that are utilized in a variety of circumstances: chkdsk, copy, ftp, del, format, ping, attrib, net, dir, help, and shutdown.
- 21 Best Command Prompt Tricks.
- Command Prompt is available on every Windows NT-based operating system which includes Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, and Windows 2000, as well as Windows Server 2012, 2008, and 2003.
- Windows PowerShell, an advanced command line interpreter available in recent Windows versions, supplements the command executing abilities available in Command Prompt.
- Windows PowerShell may eventually replace the Command Prompt in a future version of Windows.
- Windows Terminal is another Microsoft-approved way of using Command Prompt and PowerShell within the same tool.
- How do I use a command prompt on macOS?