Repository navigation
Expand file tree
/
Copy pathVisual-Studio-Code
More file actions
40 lines (22 loc) · 1.47 KB
/
Copy pathVisual-Studio-Code
File metadata and controls
40 lines (22 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
winget install --id Microsoft.VisualStudioCode --source winget
code --install-extension ms-vscode.PowerShell
code "$env:APPDATA\Code\User\settings.json"
--------------------------------------------------------------------------------------------------------------------------------------------
$settingsPath = "$env:APPDATA\Code\User\settings.json"
# Create file/folder if it doesn't exist
if (-not (Test-Path $settingsPath)) {
New-Item -ItemType File -Path $settingsPath -Force | Out-Null
"{}" | Set-Content $settingsPath
}
# Read existing JSON or initialize
$json = Get-Content $settingsPath -Raw | ConvertFrom-Json
# Add/over-write settings
$json | Add-Member -NotePropertyName "terminal.integrated.defaultProfile.windows" -NotePropertyValue "PowerShell" -Force
$json | Add-Member -NotePropertyName "powershell.integratedConsole.showOnStartup" -NotePropertyValue $true -Force
$json | Add-Member -NotePropertyName "editor.formatOnSave" -NotePropertyValue $true -Force
$json | Add-Member -NotePropertyName "powershell.codeFormatting.preset" -NotePropertyValue "OTBS" -Force
# Save updated settings back to file
$json | ConvertTo-Json -Depth 12 | Set-Content $settingsPath
--------------------------------------------------------------------------------------------------------------------------------------------
Get-Content $settingsPath
--------------------------------------------------------------------------------------------------------------------------------------------