- Command Prompt: What It Is and How to Use It
- Command Prompt is available in most Windows operating systems
- How to Access Command Prompt
- How to Use Command Prompt
- Command Prompt Commands
- Command Prompt Availability
- start
- Syntax
- Parameters
- Remarks
- Examples
- start start
- Синтаксис Syntax
- Параметры Parameters
- Комментарии Remarks
- Примеры Examples
Command Prompt: What It Is and How to Use It
Command Prompt is available in most Windows operating systems
Command Prompt is a command line interpreter application available in most Windows operating systems. It’s used to execute entered commands. 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 or cmd prompt, or even by its filename, cmd.exe.
Command Prompt is sometimes incorrectly referred to as «the DOS prompt» or as MS-DOS itself. Command Prompt is a Windows program that emulates many of the command line abilities available in MS-DOS, but it’s not MS-DOS.
Cmd is also an abbreviation for many other technology terms like centralized message distribution, color monitor display, and common management database, but none of them have anything to do with Command Prompt.
How to Access Command Prompt
There are several ways to open Command Prompt, but the «normal» method is via the Command Prompt shortcut located in the Start menu or on the Apps screen, depending on your version of Windows.
The shortcut is faster for most people, but another way to access Command Prompt is via the cmd Run command. You can also open cmd.exe from its original location:
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.
Many commands can only be executed if you’re running the Command Prompt as an administrator.
How to Use Command Prompt
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.
Command Prompt Commands
A large number of commands exist in Command Prompt, but their availability differs from operating system to operating system. You can view which Command Prompt commands are compatible with a specific operating system here:
Following those command lists will prove that 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.
Command Prompt Availability
Command Prompt is available on every Windows NT-based operating system which includes 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.
start
Starts a separate Command Prompt window to run a specified program or command.
Syntax
Parameters
Parameter | Description |
---|---|
Specifies the title to display in the Command Prompt window title bar. | |
/d |
. ]]
Remarks
You can run non-executable files through their file association by typing the name of the file as a command.
If you run a command that contains the string CMD as the first token without an extension or path qualifier, CMD is replaced with the value of the COMSPEC variable. This prevents users from picking up cmd from the current directory.
If you run a 32-bit graphical user interface (GUI) application, cmd does not wait for the application to quit before returning to the command prompt. This behavior does not occur if you run the application from a command script.
If you run a command that uses a first token that does not contain an extension, Cmd.exe uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is:
Note that the syntax is the same as the PATH variable, with semicolons (;) separating each extension.
When searching for an executable file, if there is no match on any extension, start checks to see if the name matches a directory name. If it does, start opens Explorer.exe on that path.
Examples
To start the Myapp program at the command prompt and retain use of the current Command Prompt window, type:
To view the start command-line help topic in a separate maximized Command Prompt window, type:
start start
Запускает отдельное окно командной строки для запуска указанной программы или команды. Starts a separate Command Prompt window to run a specified program or command.
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
Задает заголовок, отображаемый в строке заголовка окна командной строки . Specifies the title to display in the Command Prompt window title bar. | |
/d |
. ]]
Комментарии Remarks
Вы можете запускать неисполняемые файлы с помощью сопоставления файлов, вводя имя файла в виде команды. You can run non-executable files through their file association by typing the name of the file as a command.
При выполнении команды, содержащей строку CMD в качестве первого маркера без квалификатора расширения или пути, команда CMD заменяется значением переменной COMSPEC. If you run a command that contains the string CMD as the first token without an extension or path qualifier, CMD is replaced with the value of the COMSPEC variable. Это не позволяет пользователям выбирать cmd из текущего каталога. This prevents users from picking up cmd from the current directory.
Если вы запускаете приложение с 32-битным графическим пользовательским интерфейсом (GUI), программа cmd не ждет завершения работы приложения, прежде чем вернуться в командную строку. If you run a 32-bit graphical user interface (GUI) application, cmd does not wait for the application to quit before returning to the command prompt. Такое поведение не происходит при запуске приложения из командного скрипта. This behavior does not occur if you run the application from a command script.
При выполнении команды, использующей первый токен, который не содержит расширение, Cmd.exe использует значение переменной среды ПАСЕКСТ, чтобы определить, какие расширения следует искать и в каком порядке. If you run a command that uses a first token that does not contain an extension, Cmd.exe uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. Значение по умолчанию для переменной ПАСЕКСТ: The default value for the PATHEXT variable is:
Обратите внимание, что синтаксис аналогичен переменной PATH с точкой с запятой (;) Отделение каждого расширения. Note that the syntax is the same as the PATH variable, with semicolons (;) separating each extension.
При поиске исполняемого файла, если нет совпадения с каким-либо расширением, запустите проверку, чтобы проверить, совпадает ли имя с именем каталога. When searching for an executable file, if there is no match on any extension, start checks to see if the name matches a directory name. Если это так, то Start открывает Explorer.exe по этому пути. If it does, start opens Explorer.exe on that path.
Примеры Examples
Чтобы запустить программу MyApp из командной строки и использовать текущее окно командной строки , введите: To start the Myapp program at the command prompt and retain use of the current Command Prompt window, type:
Чтобы просмотреть раздел справки по командной строке в отдельном окне командной строки с развернутым окном, введите: To view the start command-line help topic in a separate maximized Command Prompt window, type: