- Windows commands
- Prerequisites
- Command shell overview
- Command-line reference A-Z
- prompt prompt
- Синтаксис Syntax
- Параметры Parameters
- Комментарии Remarks
- Примеры Examples
- prompt
- Syntax
- Parameters
- Remarks
- Examples
- Команды Windows Windows commands
- Предварительные требования Prerequisites
- Общие сведения о командной оболочке Command shell overview
- Справочник по командной строке A-Z Command-line reference A-Z
Windows commands
All supported versions of Windows (server and client) 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.
Prerequisites
The information that is contained in this topic applies to:
- Windows Server 2019
- Windows Server (Semi-Annual Channel)
- Windows Server 2016
- Windows Server 2012 R2
- Windows Server 2012
- Windows Server 2008 R2
- Windows Server 2008
- Windows 10
- Windows 8.1
Command shell overview
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.
Windows has two command 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.
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 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.
You can also download and install PowerShell Core, the open source version of PowerShell.
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.
To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:
To set the reg_DWOrd value, 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.
Command-line reference A-Z
To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.
prompt prompt
Изменяет Cmd.exe командной строки, включая отображение любого нужного текста, например имя текущего каталога, дату и время или номер версии Microsoft Windows. Changes the Cmd.exe command prompt, including displaying any text you want, such as the name of the current directory, the time and date, or the Microsoft Windows version number. При использовании без параметров эта команда сбрасывает командную строку до значения по умолчанию, которое представляет собой текущую букву диска и каталог, за которыми следует символ «больше чем» ( > ). If used without parameters, this command resets the command prompt to the default setting, which is the current drive letter and directory followed by the greater than symbol (>).
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
Задает текст и сведения, которые необходимо включить в командную строку. Specifies the text and information that you want to include in the command prompt. | |
/? /? | Отображение справки в командной строке. Displays help at the command prompt. |
Комментарии Remarks
Сочетания символов, которые можно включить вместо или в дополнение к одной или нескольким символьным строкам в текстовом параметре: The character combinations you can include instead of, or in addition to, one or more character strings in the text parameter:
Символ Character | Описание Description |
---|---|
$q $q | = (Знак равенства) = (Equal sign) |
$$ | $ (Знак доллара) $ (Dollar sign) |
$t $t | Текущее время Current time |
$d $d | Текущая дата Current date |
$p $p | Текущий диск и путь Current drive and path |
$v $v | Номер версии Windows Windows version number |
$n $n | Текущий диск Current drive |
$g $g | > (больше чем знак) > (Greater than sign) |
$l $l | |
$b $b | | (Символ вертикальной черты) | (Pipe symbol) |
$ $ | ВВОД-ПЕРЕВОД СТРОКИ ENTER-LINEFEED |
$e $e | Escape-код ANSI (код 27) ANSI escape code (code 27) |
$h $h | Backspace (для удаления символа, записанного в командную строку) Backspace (to delete a character that has been written to the command line) |
$a $a | & (амперсанд) & (Ampersand) |
$c $c | ((Левая круглая скобка) ( (Left parenthesis) |
$f $f | ) (Правая круглая скобка) ) (Right parenthesis) |
$s $s | Пробел Space |
Если расширения команд включены, команда Prompt поддерживает следующие символы форматирования: When command extensions are enabled the prompt command supports the following formatting characters:
Символ Character | Описание Description |
---|---|
$+ | Ноль или более символов плюса ( + ) в зависимости от глубины стека pushd Directory (по одному символу для каждого уровня). Zero or more plus sign (+) characters, depending on the depth of the pushd directory stack (one character for each level pushed). |
$m $m | Удаленное имя, связанное с текущей буквой диска или пустой строкой, если текущий диск не является сетевым диском. The remote name associated with the current drive letter or the empty string if current drive is not a network drive. |
Если включить $p символ в текстовый параметр, диск считывается после ввода каждой команды (для определения текущего диска и пути). If you include the $p character in the text parameter, your disk is read after you enter each command (to determine the current drive and path). Это может занять некоторое время, особенно для дисководов гибких дисков. This can take extra time, especially for floppy disk drives.
Примеры Examples
Чтобы установить в командной строке с двумя строками текущее время и дату в первой строке и знак «больше чем» на следующей строке, введите: To set a two-line command prompt with the current time and date on the first line and the greater than sign on the next line, type:
Запрос изменится следующим образом, где Дата и время будут актуальными: The prompt is changed as follows, where the date and time are current:
Чтобы настроить командную строку для вывода в виде стрелки ( —> ), введите: To set the command prompt to display as an arrow ( —> ), type:
Чтобы вручную изменить командную строку на значение по умолчанию (текущий диск и путь, за которым следует знак «больше чем»), введите: To manually change the command prompt to the default setting (the current drive and path followed by the greater than sign), type:
prompt
Changes the Cmd.exe command prompt, including displaying any text you want, such as the name of the current directory, the time and date, or the Microsoft Windows version number. If used without parameters, this command resets the command prompt to the default setting, which is the current drive letter and directory followed by the greater than symbol (>).
Syntax
Parameters
Remarks
The character combinations you can include instead of, or in addition to, one or more character strings in the text parameter:
Character | Description |
---|---|
$q | = (Equal sign) |
$$ | $ (Dollar sign) |
$t | Current time |
$d | Current date |
$p | Current drive and path |
$v | Windows version number |
$n | Current drive |
$g | > (Greater than sign) |
$l | | (Pipe symbol) |
$_ | ENTER-LINEFEED |
$e | ANSI escape code (code 27) |
$h | Backspace (to delete a character that has been written to the command line) |
$a | & (Ampersand) |
$c | ( (Left parenthesis) |
$f | ) (Right parenthesis) |
$s | Space |
When command extensions are enabled the prompt command supports the following formatting characters:
Character | Description |
---|---|
$+ | Zero or more plus sign (+) characters, depending on the depth of the pushd directory stack (one character for each level pushed). |
$m | The remote name associated with the current drive letter or the empty string if current drive is not a network drive. |
If you include the $p character in the text parameter, your disk is read after you enter each command (to determine the current drive and path). This can take extra time, especially for floppy disk drives.
Examples
To set a two-line command prompt with the current time and date on the first line and the greater than sign on the next line, type:
The prompt is changed as follows, where the date and time are current:
To set the command prompt to display as an arrow ( —> ), type:
To manually change the command prompt to the default setting (the current drive and path followed by the greater than sign), type:
Команды Windows Windows commands
Все поддерживаемые версии Windows (сервер и клиент) имеют набор встроенных команд консоли Win32. All supported versions of Windows (server and client) have a set of Win32 console commands built in.
Этот набор документации описывает команды Windows, которые можно использовать для автоматизации задач с помощью скриптов или средств создания скриптов. This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.
Предварительные требования Prerequisites
Сведения, содержащиеся в этом разделе, применимы к: The information that is contained in this topic applies to:
- Windows Server 2019 Windows Server 2019
- Windows Server (Semi-Annual Channel) Windows Server (Semi-Annual Channel)
- Windows Server 2016 Windows Server 2016
- Windows Server 2012 R2 Windows Server 2012 R2
- Windows Server 2012 Windows Server 2012
- Windows Server 2008 R2 Windows Server 2008 R2
- Windows Server 2008 Windows Server 2008
- Windows 10 Windows 10
- Windows 8.1 Windows 8.1
Общие сведения о командной оболочке Command shell overview
Командная оболочка была первой оболочкой, встроенной в Windows, для автоматизации стандартных задач, таких как управление учетными записями пользователей или ночное резервное копирование с пакетными файлами (bat). 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. С помощью сервера сценариев Windows можно выполнять более сложные сценарии в командной оболочке. With Windows Script Host you could run more sophisticated scripts in the Command shell. Дополнительные сведения см. в разделе cscript или Wscript. 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.
Windows имеет две командные оболочки: Командная оболочка и PowerShell. Windows has two command 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.
PowerShell был разработан для расширения возможностей командной оболочки для выполнения команд PowerShell, называемых командлетами. PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Командлеты похожи на команды Windows, но предоставляют более расширяемый язык сценариев. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. Вы можете выполнять команды Windows и командлеты PowerShell в PowerShell, но Командная оболочка может выполнять только команды Windows, а не командлеты PowerShell. You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.
Для наиболее надежной и последней версии службы автоматизации Windows рекомендуется использовать PowerShell вместо команд Windows или сервера сценариев Windows для службы автоматизации Windows. For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.
Вы также можете скачать и установить PowerShell Core, версию PowerShell с открытым исходным кодом. You can also download and install PowerShell Core, the open source version of PowerShell.
Неправильное изменение реестра может серьезно повредить систему. 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.
Чтобы включить или отключить завершение имен файлов и каталогов в командной оболочке на компьютере или в сеансе входа пользователя, запустите regedit.exe и задайте следующее значение reg_DWOrd: To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\completionChar\reg_DWOrd HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\completionChar\reg_DWOrd
Чтобы задать значение reg_DWOrd , используйте шестнадцатеричное значение управляющего символа для конкретной функции (например, 0 9 — TAB, а 0 08 — Backspace). To set the reg_DWOrd value, 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.
Справочник по командной строке A-Z Command-line reference A-Z
Чтобы найти сведения о конкретной команде, в следующем меню A-Z щелкните букву, с которой начинается команда, а затем щелкните имя команды. To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.
Объект | Б | C | Г | Д | F | Ж | З | Я | J | Л | L | М | N | O | P | Вопросы и ответы | Язык R | С | T | U | Версия | Н | X | Y | Гармошкой 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