admin管理员组文章数量:1356709
The setting file of windows terminal on my PC lies in the directory "C:\Users\gaoqiang\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState". I have a question on this path. What's the meaning of "_8wekyb3d8bbwe"? Is it safe to write this path in a script? I mean, does this path change in different version of windows terminal, or different version of windows?
The setting file of windows terminal on my PC lies in the directory "C:\Users\gaoqiang\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState". I have a question on this path. What's the meaning of "_8wekyb3d8bbwe"? Is it safe to write this path in a script? I mean, does this path change in different version of windows terminal, or different version of windows?
Share Improve this question edited Mar 31 at 8:11 Junjie Zhu - MSFT 3,0491 gold badge4 silver badges8 bronze badges asked Mar 31 at 7:41 gaoqianggaoqiang 1011 bronze badge2 Answers
Reset to default 1Unfortunately, this path is not reliable. In fact, most of the time Windows Terminal (WT) retrieves its configuration from
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
(8wekyb3d8bbwe
is Microsoft's PublisherId
and ensures that names won't be conflicted if another editor also distributes an application named Windows Terminal
). If that path exists, in principle it should be the right one.
However, on my work PC, WT stores its configuration in
%LOCALAPPDATA%\Microsoft\Windows Terminal
: this is enforced by my company's GPOs, which notably block access to the Windows Store - so we obtain the applications that would normally be there from a different source, which does things its own way. There is also no suitable registry key to locate the WT path - not without a fairly in-depth registry analysis, which wouldn’t be much simpler or faster than searching for all the settings.json
files on the PC.
You can try the default path and look for the settings.json
file there. If it isn’t found, you can search for this file throughout the entire %LOCALAPPDATA%
directory tree (maybe only Packages
and Microsoft
subfolders first?), and if that still doesn’t work, across the entire PC (excluding network and removable drives, of course).
To confirm that the file found is indeed the correct one, the presence of at least one of the following JSON keys seems sufficient:
"$help": "https://aka.ms/terminal-documentation"
"$schema": "https://aka.ms/terminal-profiles-schema-preview"
So long as you're always just using the stable version of the Windows Terminal, as downloaded from
- the Microsoft Store
- winget
- the
.msix
straight from the Terminal releases
then
%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
will always be the path to your settings file. That's the path that the packaged installation of the Terminal uses. This is the default install that most users have.
There's a couple edge cases that don't apply to everyone:
- As @Wisblade mentioned: Unpackaged installs. This is for folks that can't use packages for some reason or another[^1]. Those installs will use
%LOCALAPPDATA%\Microsoft\Windows Terminal
as the path to the settings. - There's also Portable installs. These are unpackaged installs with an added
settings/
directory next toWindowsTerminal.exe
. In that case, the settings file will live in that directory.
You can read more about the different types of Terminal installs here: Windows Terminal Distribution Types
If you're writing a tool for yourself, then you're probably fine just picking the one you use, and hardcoding that.
[^1]: FWIW, their could use the Preinstall_Kit.zip
we ship to avoid needing a dependency on the Store.
本文标签:
版权声明:本文标题:A question on the path of windows terminal settings - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743962040a2569206.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论