Windows 터미널에 명령줄 인수 사용Using command-line arguments for Windows Terminal
wt.exe
를 사용하여 명령줄에서 Windows 터미널의 새 인스턴스를 열 수 있습니다.You can use wt.exe
to open a new instance of Windows Terminal from the command line. 실행 별칭인 wt
를 대신 사용할 수도 있습니다.You can also use the execution alias wt
instead.
참고
GitHub의 소스 코드로 Windows 터미널을 빌드한 경우 wtd.exe
또는 wtd
를 사용하여 해당 빌드를 열 수 있습니다.If you built Windows Terminal from the source code on GitHub, you can open that build using wtd.exe
or wtd
.
명령줄 구문Command line syntax
wt
명령줄은 옵션 및 명령의 두 가지 값을 허용합니다.The wt
command line accepts two types of values: options and commands. 옵션은 wt
명령줄의 동작을 전체적으로 제어할 수 있는 플래그 및 기타 매개 변수의 목록입니다.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. 명령을 지정하지 않으면 기본적으로 명령을 new-tab
으로 간주합니다.If no command is specified, then the command is assumed to be new-tab
by default.
wt [options] [command ; ]
사용 가능한 명령줄 인수를 나열하는 도움말 메시지를 표시하려면 wt -h
, wt --help
, wt -?
또는 wt /?
를 입력합니다.To display a help message listing the available command-line arguments, enter: wt -h
, wt --help
, wt -?
, or wt /?
.
옵션 및 명령Options and commands
아래는 wt
명령줄을 지원하는 명령 및 옵션의 전체 목록입니다.Below is the full list of supported commands and options for the wt
command line.
옵션Option | 설명Description |
---|---|
--help , -h , -? , /? --help , -h , -? , /? |
도움말 메시지를 표시합니다.Displays the help message. |
--maximized , -M --maximized , -M |
터미널을 최대화하여 시작합니다.Launches the terminal maximized. |
--fullscreen , -F --fullscreen , -F |
터미널을 전체 화면으로 시작합니다.Launches the terminal as full screen. |
중요
--maximized
, -M
및 --fullscreen
, -F
는 Windows 터미널 미리 보기에서만 사용할 수 있습니다.--maximized
, -M
and --fullscreen
, -F
are only available in Windows Terminal Preview.
명령Command | 매개 변수Parameters | 설명Description |
---|---|---|
new-tab |
--profile, -p profile-name , --startingDirectory, -d starting-directory , commandline , --title --profile, -p profile-name , --startingDirectory, -d starting-directory , commandline , --title |
새 탭을 만듭니다.Creates a new tab. |
split-pane |
-H, --horizontal , -V, --vertical , --profile, -p profile-name , --startingDirectory, -d starting-directory , commandline , --title -H, --horizontal , -V, --vertical , --profile, -p profile-name , --startingDirectory, -d starting-directory , commandline , --title |
새 창을 분할합니다.Splits a new pane. |
focus-tab |
--target, -t tab-index |
포커스를 특정 탭으로 이동합니다.Focuses on a specific tab. |
중요
--title
은 Windows 터미널 미리 보기에서만 사용할 수 있습니다.--title
is only available in Windows Terminal Preview.
명령줄 인수 예제Command line argument examples
사용하는 명령줄에 따라 명령이 약간씩 다를 수 있습니다.Commands may vary slightly depending on which command line you're using.
새 프로필 인스턴스 열기Open a new profile instance
새 터미널 인스턴스를 열려면(여기서는 명령이 "Ubuntu-18.04"라는 프로필을 엽니다) 다음을 입력합니다.To open a new terminal instance, in this case the command will open the profile named "Ubuntu-18.04", enter:
wt -p "Ubuntu-18.04"
-p
플래그는 열어야 하는 Windows 터미널 프로필을 지정하는 데 사용됩니다.The -p
flag is used to specify the Windows Terminal profile that should be opened. "Ubuntu-18.04"를 설치한 터미널 프로필의 이름으로 바꿉니다.Substitute "Ubuntu-18.04" with the name of any terminal profile that you have installed. 이렇게 하면 항상 새 창이 열립니다.This will always open a new window. Windows 터미널은 아직 기존 인스턴스에서 새 탭 또는 창을 열 수 없습니다.Windows Terminal is not yet capable of opening new tabs or panes in an existing instance.
대상 디렉터리 지정Target a directory
콘솔의 시작 디렉터리로 사용할 폴더를 지정하려면(여기서는 d:\ 디렉터리) 다음을 입력합니다.To specify the folder that should be used as the starting directory for the console, in this case the d:\ directory, enter:
여러 탭Multiple tabs
여러 탭이 있는 새 터미널 인스턴스를 열려면 다음을 입력합니다.To open a new terminal instance with multiple tabs, enter:
여러 탭이 있는 새 터미널 인스턴스를 열려면(여기서는 명령 프롬프트 프로필 및 PowerShell 프로필) 다음을 입력합니다.To open a new terminal instance with multiple tabs, in this case a Command Prompt profile and a PowerShell profile, enter:
wt -p "Command Prompt" ; new-tab -p "Windows PowerShell"
여러 창Multiple panes
탭이 하나 있고 이 탭의 3개 창에서 3가지 프로필(명령 프롬프트 프로필, PowerShell 프로필 및 WSL 명령줄을 실행하는 기본 프로필)이 실행되고 있는 새 터미널 인스턴스를 열려면 다음을 입력합니다.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:
wt -p "Command Prompt" ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe
-H
플래그(또는 --horizontal
)는 창을 가로로 분할한다는 것을 나타냅니다.The -H
flag (or --horizontal
) indicates that you would like the panes to be split horizontally. -V
플래그(또는 --vertical
)는 창을 세로로 분할한다는 것을 나타냅니다.The -V
flag (or --vertical
) indicates that you would like the panes split vertically.
탭 제목(미리 보기)Tab title (Preview)
사용자 지정 탭 제목이 있는 새 터미널 인스턴스를 열려면 --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:
wt --title tabname1 ; new-tab -p "Ubuntu-18.04" --title tabname2
중요
이 기능은 Windows 터미널 미리 보기에서만 사용할 수 있습니다.This feature is only available in Windows Terminal Preview.
탭 포커스Tab focus
특정 탭에 포커스가 있는 새 터미널 인스턴스를 열려면 탭 인덱스 번호와 함께 -t
플래그(또는 --target
)를 사용합니다.To open a new terminal instance with a specific tab in focus, use the -t
flag (or --target
), along with the tab-index number. 첫 번째 탭에서 기본 프로필을 열고 두 번째 탭(-t 1
)에서 "Ubuntu-18.04" 프로필을 열고 포커스를 두려면 다음을 입력합니다.To open your default profile in the first tab and the "Ubuntu-18.04" profile focused in the second tab (-t 1
), enter:
wt ; new-tab -p "Ubuntu-18.04" ; focus-tab -t 1
PowerShell의 여러 명령 예제Examples of multiple commands from PowerShell
Windows 터미널은 명령줄에서 wt
명령줄을 구분하는 구분 기호로 세미콜론 문자(;
)를 사용합니다.Windows Terminal uses the semicolon character ;
as a delimiter for separating commands in the wt
command line. 아쉽게도 PowerShell 역시 ;
을 명령 구분 기호로 사용합니다.Unfortunately, PowerShell also uses ;
as a command separator. 이 문제를 해결하려면 다음 팁을 사용하여 PowerShell에서 여러 wt
명령을 실행하면 됩니다.To work around this, you can use the following tricks to run multiple wt
commands from PowerShell. 아래의 모든 예제에서는 명령 프롬프트를 실행하는 창, PowerShell을 실행하는 창, WSL을 실행하는 창의 총 3개 창이 있는 새 터미널 창이 생성됩니다.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.
다음 예제에서는 Start-Process
명령을 사용하여 wt
를 실행합니다.The following examples use the Start-Process
command to run wt
. 터미널에서 Start-Process
를 사용하는 이유에 대한 자세한 내용은 아래의 start 사용을 참조하세요.For more information on why the terminal uses Start-Process
, see Using start below.
작은따옴표로 묶은 매개 변수Single quoted parameters
이 예제에서는 wt
매개 변수가 작은따옴표('
)로 래핑됩니다.In this example, the wt
parameters are wrapped in single quotes ('
). 이 구문은 아무것도 계산되지 않는 경우에 유용합니다.This syntax is useful if nothing is being calculated.
start wt 'new-tab "cmd" ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe'
이스케이프된 따옴표Escaped quotes
변수에 포함된 값을 wt
명령줄에 전달할 때 다음 구문을 사용합니다.When passing a value contained in a variable to the wt
command line, use the following syntax:
$ThirdPane = "wsl.exe"
start wt "new-tab cmd ; split-pane -p `"Windows PowerShell`" ; split-pane -H $ThirdPane"
-p
매개 변수에서 "Windows PowerShell"을 묶는 큰따옴표("
)를 split-pane
매개 변수로 이스케이프하기 위해 `
를 사용했습니다.Note the usage of `
to escape the double-quotes ("
) around "Windows PowerShell" in the -p
parameter to the split-pane
parameter.
start
시작Using start
위의 모든 예제에서는 명시적으로 start
를 사용하여 터미널을 시작했습니다.All the above examples explicitly used start
to launch the terminal.
다음 예제에서는 명령줄 실행에 start
를 사용하지 않습니다.The following examples do not use start
to run the command line. 그 대신 다음 두 가지 방법으로 명령줄을 이스케이프합니다.Instead, there are two other methods of escaping the command line:
PowerShell
에서 세미콜론을 무시하고wt
에 바로 전달하도록 세미콜론만 이스케이프합니다.Only escaping the semicolons so thatPowerShell
will ignore them and pass them straight towt
.- PowerShell이 명령줄의 나머지 부분을 애플리케이션의 인수로 처리하도록
--%
를 사용합니다.Using--%
, so PowerShell will treat the rest of the command line as arguments to the application.
wt new-tab "cmd" `; split-pane -p "Windows PowerShell" `; split-pane -H wsl.exe
wt --% new-tab cmd ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe
이러한 두 예제에서 새로 만든 Windows 터미널 창은 제공된 모든 명령줄 인수를 올바르게 구문 분석하여 창을 생성합니다.In both of these examples, the newly created Windows Terminal window will create the window by correctly parsing all the provided command-line arguments.
그러나 제어권을 PowerShell에 반환하려면 새로 만든 터미널 창이 닫힐 때까지 PowerShell이 대기해야 하므로 현재는 이러한 방법을 권장하지 않습니다.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. 기본적으로 PowerShell은 항상 Windows 터미널 같은 Windows 스토어 애플리케이션이 종료될 때까지 기다렸다가 프롬프트로 돌아갑니다.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.