简体   繁体   中英

How can I open the Windows Terminal settings in VSCode from the command line?

I'm able to open my PowerShell profile in VSCode from the command line with the command 'code $PROFILE', but I'm wondering how to do the same for the Windows Terminal settings.

I tried to set a Settings alias for the settings.json file, but 'code Settings' just opened a blank page titled Settings in VSCode.

When I used my Settings alias without the 'code' in front of it, it opened up the file in VSCode (because I have VSCode set as the default program for JSON files).

I'm not sure if the package/directory name is unique or not, so to be safe you can find and then open the settings.json.

Get-ChildItem $env:LOCALAPPDATA\packages\Microsoft.WindowsTerminal* -Filter settings.json -Recurse | ForEach-Object {code $_}

This works as long as you load in in your PS/VSC Profile, or set it as an environment variable.

$WTSettings = (Get-ChildItem "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState" -Filter settings.json).FullName
code $WTSettings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM