Windows commands (2024)

  • Article

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.

Command-line shells

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. Windows Commands also include command redirection operators. To learn more of their use, see Using command redirection operators.

Note

You can also download and install PowerShell Core, the open source version of PowerShell.

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 following registry keys and entries, depending on whether you wish to change the value for the current user only, or for all users of the computer.

Caution

Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionCharHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\PathCompletionChar

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 isn't a valid control character. The type of value for this registry entry is REG_DWORD, and can also 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:ON or /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

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Windows commands (2024)

FAQs

How do I get a list of commands in Windows? ›

Type help and press ↵ Enter . A list of all the available commands will be displayed. The listed is sorted alphabetically. The list is usually larger than the Command Prompt window, so you may need to scroll up to find the command you want.

What command can be used on Windows? ›

21. Tasklist
CMD COMMANDPURPOSE
CD – Change DirectoryShows and changes the current directory to a new location
REN: RenameRenames files or directories
ASSOC: Fix File AssociationsAssociates an extension to open a program or application
MkdirCreates subdirectories within the directories
17 more rows

How many commands are there in Windows 10? ›

The Windows operating system features over 280 commands for CMD (Command Prompt). Some commands are specific to Windows servers, while others are available for desktop versions.

How do I get Windows commands? ›

Select the Start Menu (the Windows icon) in the taskbar, or press the Windows key. Type cmd. Select Command Prompt from the list. If you're using the latest version of Windows 11, Command Prompt will open within Terminal.

How do I show Windows commands? ›

Open the Start menu or press the Windows key + R. Type cmd or cmd.exe in the Run command box. Press Enter.

How do I view commands in Windows? ›

Press Win + R keys to open the Run dialog box, and then type cmd in it and hit Enter. Step 2. In the Command Prompt window, press and hold the F7 key to view the history of Command Prompt. Then it will open the list of commands you currently typed in.

What are Command Prompt codes? ›

Common Windows Command Prompt (CMD) commands:
  • `dir`: Lists files and directories in the current directory.
  • `cd`: Changes the current directory.
  • `md`: Creates a new directory.
  • `rd`: Removes (deletes) a directory.
  • `copy`: Copies files.
  • `del`: Deletes files.
  • `ren`: Renames files.
May 16, 2023

How do I use window commands? ›

Hold the special Windows key on your keyboard and press the "X" key. Choose "Command Prompt" from the pop-up menu. Hold the Windows key and press the "R" key to get a "Run" window. Type "cmd" in the box, and click the OK key.

What is Windows key command? ›

The Windows key (winkey) is a button on a Windows computer keyboard. It has the Microsoft Windows logo on it, distinguishing it from all other keys. It is also known as the WK. On Mac systems, the winkey becomes the Command key.

What is the command to list all services Windows? ›

Top Windows command-line commands

Anytime you want to know what services are installed on a computer and find out which ones are active, you can use sc query state= all to find a complete list. If the computer in question is remote, you should use sc \\computername query state= all.

What command opens all Windows? ›

Use Task View to show all windows on the same screen.

This displays all windows on a single screen and is the simplest way to see all open windows. You can also open Task View by pressing Windows key + Tab.

How do I write commands in Windows 10? ›

You can also press the 'Win + R' keys simultaneously to open the run box, then type 'cmd' and press 'Enter'. Another option is to press 'Win + R' or right click your start button and select 'Command Prompt' from the menu that appears.

Where do I run Windows commands? ›

Easily open Command Prompt by running Windows Run by holding the Windows button and hitting the R button on your keyboard. You can then type "cmd" and press enter, opening Command Prompt.

What is PowerShell used for? ›

As a scripting language, PowerShell is commonly used for automating the management of systems. It's also used to build, test, and deploy solutions, often in CI/CD environments.

What does cmd stand for? ›

What is CMD? CMD is an abbreviation of the word “command” and is used when referencing Windows command processor, aka Command Prompt. CMD is a powerful tool for Windows operating systems that allows users to interact with the computer using text-based CMD commands through the command line interface.

How can I get a list of commands in PowerShell? ›

The Get-Command cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. Get-Command gets the commands from PowerShell modules and commands that were imported from other sessions.

Which command is used to get the list of services in Windows? ›

To find the service name and display name of each service on your system, type Get-Service . The service names appear in the Name column, and the display names appear in the DisplayName column. Typically, Get-Service returns information about services and not driver.

How do I get a list of tasks from Command Prompt? ›

Open a Command prompt ( cmd.exe ) and use the following commands: Type tasklist to output a list of all the currently running processes. To output as a txt, type tasklist /v txt.

How do I get a list of items in cmd? ›

You can use the DIR command by itself (just type "dir" at the Command Prompt) to list the files and folders in the current directory.

Top Articles
Latest Posts
Article information

Author: Gregorio Kreiger

Last Updated:

Views: 6164

Rating: 4.7 / 5 (57 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Gregorio Kreiger

Birthday: 1994-12-18

Address: 89212 Tracey Ramp, Sunside, MT 08453-0951

Phone: +9014805370218

Job: Customer Designer

Hobby: Mountain biking, Orienteering, Hiking, Sewing, Backpacking, Mushroom hunting, Backpacking

Introduction: My name is Gregorio Kreiger, I am a tender, brainy, enthusiastic, combative, agreeable, gentle, gentle person who loves writing and wants to share my knowledge and understanding with you.