The state.json file in Windows Terminal is an important configuration file that stores various settings and preferences for the application. It is located in the following directory:
C:\Users\{your_username}\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
This file is written in JSON format, which stands for JavaScript Object Notation. JSON is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate.
The state.json file contains information about the appearance and behavior of Windows Terminal, such as the color scheme, font settings, and key bindings. It also stores information about the profiles that are available in the application.
Profiles in Windows Terminal represent different command-line applications or shells that you can use within the terminal. Each profile has its own set of settings, including the command to run, the starting directory, and the appearance.
To understand the structure of the state.json file, let's take a look at an example:
{
"defaultProfile": "{00000000-0000-0000-ba54-000000000001}",
"profiles": [
{
"guid": "{00000000-0000-0000-ba54-000000000001}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
"guid": "{00000000-0000-0000-ba54-000000000002}",
"name": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false
}
]
}
In this example, we have two profiles: "Windows PowerShell" and "Command Prompt". Each profile has a unique identifier (guid), a name, a commandline property that specifies the command to run, and a hidden property that determines whether the profile is visible in the terminal dropdown menu.
You can customize the state.json file to add or modify profiles, change the appearance of the terminal, or tweak other settings. However, it is important to exercise caution when editing this file, as incorrect changes can cause Windows Terminal to malfunction.
If you are new to JSON or unsure about making changes to the state.json file, it is recommended to use the Windows Terminal settings UI to modify the configuration. This provides a user-friendly interface that abstracts away the complexity of the JSON structure.
Remember to back up the state.json file before making any changes, so you can restore it if something goes wrong.
References
| Source | Link |
|---|---|
| Windows Terminal Documentation | https://docs.microsoft.com/en-us/windows/terminal/ |
| JSON.org | https://www.json.org/ |