Windows cmd all arguments

Using command line arguments for Windows Terminal

You can use wt.exe to open a new instance of Windows Terminal from the command line. You can also use the execution alias wt instead.

If you built Windows Terminal from the source code on GitHub, you can open that build using wtd.exe or wtd .

Command line syntax

The wt command line accepts two types of values: options and commands. Options are a list of flags and other parameters that can control the behavior of the wt command line as a whole. Commands provide the action, or list of actions separated by semicolons, that should be implemented. If no command is specified, then the command is assumed to be new-tab by default.

To display a help message listing the available command line arguments, enter: wt -h , wt —help , wt -? , or wt /? .

Options and commands

Below is the full list of supported commands and options for the wt command line.

Option Description
—help , -h , -? , /? Displays the help message.
—maximized , -M Launches the terminal maximized.
—fullscreen , -F Launches the terminal as full screen.
—focus , -f Launches the terminal in the focus mode. Can be combined with maximized .
—window , -w Launches the terminal in a specific window.
Command Parameters Description
new-tab , nt —profile, -p profile-name , —startingDirectory, -d starting-directory , commandline , —title , —tabColor Creates a new tab.
split-pane , sp -H, —horizontal , -V, —vertical , —profile, -p profile-name , —startingDirectory, -d starting-directory , —title , —tabColor , —size, -s size , commandline , -D, —duplicate Splits a new pane.
focus-tab , ft —target, -t tab-index Focuses on a specific tab.
move-focus , mf direction Move focus between panes in the given direction. Accepts one of up , down , left , right .

When opening Windows Terminal from cmd (Command Prompt), if you want to use your custom «cmd» profile settings, you will need to use the command wt -p cmd . Otherwise, to run your default profile settings, just use wt cmd .

The -D, —duplicate parameter for split-pane is only available in Windows Terminal Preview.

Command line argument examples

Commands may vary slightly depending on which command line you’re using.

Target a specific window

The ability for the —window,-w parameter to accept window names is only available in Windows Terminal Preview.

Below are examples of how to target specific windows using the —window,-w option.

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running.

Open a new profile instance

To open a new terminal instance, in this case the command will open the profile named «Ubuntu-18.04», enter:

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running.

The -p flag is used to specify the Windows Terminal profile that should be opened. Substitute «Ubuntu-18.04» with the name of any terminal profile that you have installed. This will always open a new window. Windows Terminal is not yet capable of opening new tabs or panes in an existing instance.

Target a directory

To specify the folder that should be used as the starting directory for the console, in this case the d:\ directory, enter:

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running.

Multiple tabs

To open a new terminal instance with multiple tabs, enter:

PowerShell uses a semicolon ; to delimit statements. To interpret a semicolon ; as a command delimiter for wt command-line arguments, you need to escape semicolon characters using backticks. PowerShell also has the stop parsing operator (—%), which instructs it to stop interpreting anything after it and just pass it on verbatim.

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running.

To open a new terminal instance with multiple tabs, in this case a Command Prompt profile and a PowerShell profile, enter:

PowerShell uses a semicolon ; to delimit statements. To interpret a semicolon ; as a command delimiter for wt command-line arguments, you need to escape semicolon characters using backticks. PowerShell also has the stop parsing operator (—%), which instructs it to stop interpreting anything after it and just pass it on verbatim.

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and the \; backslash + semicolon separates commands.

Multiple panes

To open a new terminal instance with one tab containing three panes running a Command Prompt profile, a PowerShell profile, and your default profile running a WSL command line, enter:

PowerShell uses a semicolon ; to delimit statements. To interpret a semicolon ; as a command delimiter for wt command-line arguments, you need to escape semicolon characters using backticks. PowerShell also has the stop parsing operator (—%), which instructs it to stop interpreting anything after it and just pass it on verbatim.

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and the \; backslash + semicolon separates commands.

The -H flag (or —horizontal ) indicates that you would like the panes to be split horizontally. The -V flag (or —vertical ) indicates that you would like the panes split vertically.

Multiple tabs and panes

The new-tab and split-pane commands can be sequenced to get multiple tabs, each with split panes. To open a new terminal instance with two tabs, each with two panes running a Command Prompt and a WSL command line, with each tab in a different directory, enter:

PowerShell uses a semicolon ; to delimit statements. To interpret a semicolon ; as a command delimiter for wt command-line arguments, you need to escape semicolon characters using backticks. PowerShell also has the stop parsing operator (—%), which instructs it to stop interpreting anything after it and just pass it on verbatim.

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and the \; backslash + semicolon separates commands. Note to specify a Windows directory as the starting directory for wsl.exe that two backslashes \\ are required.

Tab title

To open a new terminal instance with custom tab titles, use the —title argument. To set the title of each tab when opening two tabs, enter:

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and the \; forward-slash + semicolon separates commands.

Using application title (Preview)

To open a new terminal instance allowing applications within it to set the tab title by sending title change messages, use the —useApplicationTitle flag. To suppress these messages, use the —suppressApplicationTitle flag. If none of these flags are provided, the behavior is inherited from the profile’s settings. To open a tab with title tabname that will not be overridden by the application, enter:

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and the \; backslash + semicolon separates commands.

This feature is only available in Windows Terminal Preview.

Tab color

To open a new terminal instance with custom tab colors, use the —tabColor argument. This argument overrides the value defined in the profile, but can be overridden as well using the tab color picker. In the following example, a new terminal is created with two tabs of different colors:

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and \; separates commands.

When —tabColor is set for a tab, it is associated with the first pane of this tab. Hence in a tab with multiple panes, the color will be applied only if the first pane is in focus. To set the tab color for additional panes, you will need to add the —tabColor parameter to the split-pane subcommand as well. In the example below, a tab with two panes is created with tab colors specified for each pane:

Color scheme (Preview)

To open a new terminal instance with a specific color scheme (instead of the colorScheme set in the profile), use the —colorScheme argument. This argument overrides the value defined in the profile.

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and \; separates commands.

This feature is only available in Windows Terminal Preview.

Tab focus

To open a new terminal instance with a specific tab in focus, use the -t flag (or —target ), along with the tab-index number. To open your default profile in the first tab and the «Ubuntu-18.04» profile focused in the second tab ( -t 1 ), enter:

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running cmd.exe . The /c option tells CMD to terminate after running and the \; backslash + semicolon separates commands.

Examples of multiple commands from PowerShell

Windows Terminal uses the semicolon character ; as a delimiter for separating commands in the wt command line. Unfortunately, PowerShell also uses ; as a command separator. To work around this, you can use the following tricks to run multiple wt commands from PowerShell. In all the following examples, a new terminal window is created with three panes — one running Command Prompt, one with PowerShell, and the last one running WSL.

The following examples use the Start-Process command to run wt . For more information on why the terminal uses Start-Process , see Using start below.

Single quoted parameters

In this example, the wt parameters are wrapped in single quotes ( ‘ ). This syntax is useful if nothing is being calculated.

Escaped quotes

When passing a value contained in a variable to the wt command line, use the following syntax:

Note the usage of ` to escape the double-quotes ( » ) around «Windows PowerShell» in the -p parameter to the split-pane parameter.

Using start

All the above examples explicitly used start to launch the terminal.

The following examples do not use start to run the command line. Instead, there are two other methods of escaping the command line:

  • Only escaping the semicolons so that PowerShell will ignore them and pass them straight to wt .
  • Using —% , so PowerShell will treat the rest of the command line as arguments to the application.

In both of these examples, the newly created Windows Terminal window will create the window by correctly parsing all the provided command-line arguments.

However, these methods are not recommended currently, as PowerShell will wait for the newly-created terminal window to be closed before returning control to PowerShell. By default, PowerShell will always wait for Windows Store applications (like Windows Terminal) to close before returning to the prompt. Note that this is different than the behavior of Command Prompt, which will return to the prompt immediately.

cmd cmd

Запускает новый экземпляр интерпретатора команд Cmd.exe. Starts a new instance of the command interpreter, Cmd.exe. Если используется без параметров, Команда cmd отображает версию и сведения об авторских правах операционной системы. If used without parameters, cmd displays the version and copyright information of the operating system.

Синтаксис Syntax

Параметры Parameters

Параметр Parameter Описание Description
/C /c Выполняет команду, указанную в строке , а затем останавливается. Carries out the command specified by string and then stops.
/k /k Выполняет команду, указанную в строке , и продолжит. Carries out the command specified by string and continues.
/s /s Изменяет обработку строки после /c или /k. Modifies the treatment of string after /c or /k.
/q /q Отключает вывод. Turns the echo off.
/d /d Отключает выполнение команд AutoRun. Disables execution of AutoRun commands.
/a /a Форматирует выходные данные внутренней команды в канал или файл как Американский национальный институт стандартов (ANSI) (ANSI). Formats internal command output to a pipe or a file as American National Standards Institute (ANSI).
/U /u Форматирует выходные данные внутренней команды в канал или файл в Юникоде. Formats internal command output to a pipe or a file as Unicode.
/t: < | > /t: < | > Задает цвета фона (b) и переднего плана (f). Sets the background (b) and foreground (f) colors.
/e: вкл. /e:on Включает расширения команд. Enables command extensions.
/e: выкл. /e:off Отключает расширения команд. Disables commands extensions.
/f: вкл. /f:on Включает завершение имени файла и каталога. Enables file and directory name completion.
/f: выкл. /f:off Отключает завершение имен файлов и каталогов. Disables file and directory name completion.
/v: вкл. /v:on Включает отложенное расширение переменных среды. Enables delayed environment variable expansion.
/v: выкл. /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 Color
0 0 Черный Black
1 1 Синий Blue
2 2 Зеленый Green
3 3 Aqua Aqua
4 4 Красный Red
5 5 Сиреневый Purple
6 6 Желтый Yellow
7 7 Белый White
8 8 Серый Gray
9 9 Светло-синий Light blue
а a светло-зеленый Light green
b b Светло-голубой Light aqua
с c Светло-красный Light red
d d Светло-фиолетовый Light purple
й e Светло-желтый Light yellow
f f Светлое белое Bright white

Remarks Remarks

Чтобы использовать несколько команд для , разделите их по разделителю команд && и заключите их в кавычки. To use multiple commands for , separate them by the command separator && and enclose them in quotation marks. Пример: For example:

При указании параметра /c или /k, Команда cmd , оставшаяся часть строки и кавычки сохраняются только при соблюдении всех следующих условий. 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:

Кроме того, не используется параметр /s. 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.

Если не указать параметр /d в строке, Cmd.exe ищет следующие подразделы реестра: 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_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_EXPAND_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.

Вы можете отключить расширения команд для определенного процесса, используя /e: Off. You can disable command extensions for a particular process by using /e:off. Вы можете включить или отключить расширения для всех параметров командной строки cmd на компьютере или сеансе пользователя, задав следующие значения REG_DWORD . 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_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

Присвойте параметру REG_DWORD значение 0 × 1 (включено) или 0 × 0 (отключено) в реестре с помощью Regedit.exe. 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 assoc

call call

chdir (CD) chdir (cd)

color color

Del (стирание) del (erase)

endlocal endlocal

for for

ftype ftype

goto goto

if if

mkdir (MD) mkdir (md)

popd popd

prompt prompt

pushd pushd

set set

setlocal setlocal

shift shift

Start (также включает изменения во внешние командные процессы) 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. Можно включить или отключить завершение имени файла для определенного процесса команды cmd с параметром /f:<On | Off>. You can enable or disable file name completion for a particular process of the cmd command with /f:<on | off>. Можно включить или отключить завершение имени файла и каталога для всех процессов команды cmd на компьютере или сеанса входа пользователя, задав следующие значения REG_DWORD . 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\CompletionChar\REG_DWORD

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\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\CompletionChar\REG_DWORD

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

Чтобы задать значение REG_DWORD , выполните Regedit.exe и используйте шестнадцатеричное значение управляющего символа для конкретной функции (например, 0 × 9 — TAB, а 0 × 08 — это BACKSPACE). 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.

Если включить завершение имен файлов и каталогов с помощью /f: on, используйте сочетание клавиш CTRL + D для завершения имен каталогов и Ctrl + f для завершения имени файла. 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. Чтобы отключить определенный символ завершения в реестре, используйте значение пробела [0 × 20], так как оно не является допустимым управляющим символом. 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.

При нажатии клавиш CTRL + D или CTRL + F обрабатывается завершение имени файла и каталога. 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. Для перемещения по списку совпадающих путей нажмите клавиши CTRL + D или CTRL + F несколько раз. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. Для перемещения по списку назад нажмите клавишу SHIFT и CTRL + D или CTRL + F одновременно. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. Чтобы отменить сохраненный список совпадающих путей и создать новый список, измените строку и нажмите клавиши CTRL + D или CTRL + F. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. Если переключиться между сочетаниями Ctrl + D и 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. Единственное различие между сочетаниями клавиш Ctrl + d и Ctrl + f заключается в том, что сочетание клавиш Ctrl + d соответствует именам каталогов, а сочетание клавиш CTRL + F соответствует именам файлов и каталогов. 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. Если вы используете автозаполнение имен файлов и каталогов во всех встроенных командах каталога (т. е. CD, MD или RD), предполагается завершение каталога. 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).

Читайте также:  Диск сброса пароля windows 10 что это
Оцените статью