Redigera

Dela via


General profile settings in Windows Terminal

The settings listed below are specific to each unique profile. If you'd like a setting to apply to all of your profiles, you can add it to the defaults section above the list of profiles in your settings.json file.

"defaults":
{
    // SETTINGS TO APPLY TO ALL PROFILES
},
"list":
[
    // PROFILE OBJECTS
]

Profile Ordering

The ordering of profiles in the "list" determines the profile index numbering. This is used to map to the launch key combo, such as Ctrl+Shift+1. To change the profile index number, simply cut/paste the profile objects above or below each other. The first in the "list" will map to index 1, hence, it will be assigned to the key combo, Ctrl+Shift+1.

Name

This is the name of the profile that will be displayed in the dropdown menu. This value is also used as the "title" to pass to the shell on startup. Some shells (like bash) may choose to ignore this initial value, while others (Command Prompt, PowerShell) may use this value over the lifetime of the application. This "title" behavior can be overridden by using tabTitle.

Property name: name

Necessity: Required

Accepts: String



Command line

This is the executable used in the profile.

Property name: commandline

Necessity: Optional

Accepts: Executable file name as a string

Default value: "cmd.exe"

Example: To run a batch file each time cmd.exe is run, set this value to "cmd.exe /k path\to\script.bat"



Starting directory

This is the directory the shell starts in when it is loaded.

Property name: startingDirectory

Necessity: Optional

Accepts: Folder location as a string

Default value: "%USERPROFILE%"

NOTE: When starting directory is not defined, the default value will be set to "%USERPROFILE%" (the path relative to your user settings, for example this may be C:\Users\<your username>). However, if the starting directory is explicitly set to null, then you will get different results depending on where you launch Terminal.

Example: Start the PowerShell profile in the GitHubRepos folder of your Documents directory by finding the powershell.exe profile and adding "startingDirectory": "%USERPROFILE%/Documents/GitHubRepos",

Example with WSL: When setting the starting directory for a Linux distribution installed via WSL, use the format: "startingDirectory": "\\\\wsl$\\DISTRO NAME\\home\\USERNAME", replacing with the placeholders with the proper names of your distribution. For example, "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\user1". If you are using the Windows Terminal Settings UI, rather than the settings.json file, to declare this path, you can use the Browse... button to select your starting directory or enter the WSL path as: //wsl.localhost/DISTRO NAME/home/USERNAME. For example, //wsl.localhost/Ubuntu-20.04/home/user1.

Default behavior: When the startingDirectory value is not specified, you will get different results depending on where you launch Terminal:

  • If you run Windows Terminal from the Start menu: %WINDIR%\System32
  • If you run wt.exe from the Start menu: %WINDIR%\System32
  • If you run wt.exe from Win+R: %USERPROFILE%
  • If you run wt.exe from the explorer address bar: whatever folder you were looking at.

Note

Backslashes need to be escaped. For example, C:\Users\USERNAME\Documents should be entered as C:\\Users\\USERNAME\\Documents.


Icon

This sets the icon that displays within the tab, dropdown menu, jumplist, and tab switcher.

Property name: icon

Necessity: Optional

Accepts: File location as a string, or an emoji

Example: By placing the icon image ubuntu.ico in the folder located at %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState, you can display the icon by adding this line to the profile in your settings.json: "icon": "ms-appdata:///roaming/ubuntu.ico".


___

Tab title

If set, this will replace the name as the title to pass to the shell on startup. Some shells (like bash) may choose to ignore this initial value, while others (Command Prompt, PowerShell) may use this value over the lifetime of the application. If you'd like to learn how to have the shell set your title, visit the tab title tutorial.

Property name: tabTitle

Necessity: Optional

Accepts: String


___

Automatically run as Administrator

If set, this profile will automatically open up in an "elevated" window (running as Administrator) by default. If you run this profile from an unelevated window, then a new elevated terminal window will be created to host this profile. If you launch this profile from an already elevated window, then it will open as a new tab.

When this property is set to false, opening this profile in an elevated window will not launch an unelevated window to host this profile. The profile will simply open in the elevated window, running as Administrator.

If you set this property in profiles.defaults, then all profiles will launch as Administrator by default, unless overridden by specifically setting this to false.

This property can be overridden in the newTab and splitPane actions, with the elevate property.

Elevated and unelevated tabs cannot exist in the same terminal window. For more details, please see the FAQ.

Property name: elevate

Necessity: Optional

Accepts: true, false

Default value: false


___

Hide profile from dropdown

If hidden is set to true, the profile will not appear in the list of profiles. This can be used to hide default profiles and dynamically generated profiles, while leaving them in your settings file. To learn more about dynamic profiles, visit the Dynamic profiles page.

Property name: hidden

Necessity: Optional

Accepts: true, false

Default value: false