48
48
https://github.com/PowerShell/vscode-powershell/blob/develop/scripts/Install-VSCode.ps1
49
49
50
50
. PARAMETER Architecture
51
- A validated string defining the bit version to download. Values can be either 64 or 32.
52
- If 64 is chosen and the OS Architecture does not match, then the x86 build will be
51
+ A validated string defining the bit version to download. Values can be either 64-bit or 32-bit .
52
+ If 64-bit is chosen and the OS Architecture does not match, then the 32-bit build will be
53
53
downloaded instead. If parameter is not used, then 64-bit is used as default.
54
54
55
55
. PARAMETER BuildEdition
68
68
has finished.
69
69
70
70
. EXAMPLE
71
- Install-VSCode.ps1 -Architecture 32
71
+ Install-VSCode.ps1 -Architecture 32-bit
72
72
73
73
Installs Visual Studio Code (32-bit) and the powershell extension.
74
74
. EXAMPLE
115
115
[CmdletBinding ()]
116
116
param (
117
117
[parameter ()]
118
- [ValidateSet (, " 64" , " 32" )]
119
- [string ]$Architecture = " 64" ,
118
+ [ValidateSet (, " 64-bit " , " 32-bit " )]
119
+ [string ]$Architecture = " 64-bit " ,
120
120
121
121
[parameter ()]
122
122
[ValidateSet (" stable" , " insider" )]
@@ -131,18 +131,19 @@ param(
131
131
132
132
if (! ($IsLinux -or $IsOSX )) {
133
133
switch ($Architecture ) {
134
- " 64" {
134
+ " 64-bit " {
135
135
if ((Get-WmiObject - Class Win32_OperatingSystem).OSArchitecture -eq " 64-bit" ) {
136
136
$codePath = $env: ProgramFiles
137
137
$bitVersion = " win32-x64"
138
138
}
139
139
else {
140
140
$codePath = ${env: ProgramFiles(x86)}
141
141
$bitVersion = " win32"
142
+ $Architecture = " 32-bit"
142
143
}
143
144
break ;
144
145
}
145
- " 32" {
146
+ " 32-bit " {
146
147
$codePath = ${env: ProgramFiles(x86)}
147
148
$bitVersion = " win32"
148
149
break ;
@@ -151,26 +152,28 @@ if (!($IsLinux -or $IsOSX)) {
151
152
switch ($BuildEdition ) {
152
153
" Stable" {
153
154
$codeCmdPath = " $codePath \Microsoft VS Code\bin\code.cmd"
155
+ $appName = " Visual Studio Code ($ ( $Architecture ) )"
154
156
break ;
155
157
}
156
158
" Insider" {
157
159
$codeCmdPath = " $codePath \Microsoft VS Code Insiders\bin\code-insiders.cmd"
160
+ $appName = " Visual Studio Code - Insiders Edition ($ ( $Architecture ) )"
158
161
break ;
159
162
}
160
163
}
161
164
try {
162
165
$ProgressPreference = ' SilentlyContinue'
163
166
164
167
if (! (Test-Path $codeCmdPath )) {
165
- Write-Host " `n Downloading latest $ ( $BuildEdition ) Visual Studio Code ..." - ForegroundColor Yellow
168
+ Write-Host " `n Downloading latest $appName ..." - ForegroundColor Yellow
166
169
Remove-Item - Force " $env: TEMP \vscode-$ ( $BuildEdition ) .exe" - ErrorAction SilentlyContinue
167
170
Invoke-WebRequest - Uri " https://vscode-update.azurewebsites.net/latest/$ ( $bitVersion ) /$ ( $BuildEdition ) " - OutFile " $env: TEMP \vscode-$ ( $BuildEdition ) .exe"
168
171
169
- Write-Host " `n Installing Visual Studio Code ..." - ForegroundColor Yellow
172
+ Write-Host " `n Installing $appName ..." - ForegroundColor Yellow
170
173
Start-Process - Wait " $env: TEMP \vscode-$ ( $BuildEdition ) .exe" - ArgumentList / silent, / mergetasks= ! runcode
171
174
}
172
175
else {
173
- Write-Host " `n Visual Studio Code is already installed." - ForegroundColor Yellow
176
+ Write-Host " `n $appName is already installed." - ForegroundColor Yellow
174
177
}
175
178
176
179
$extensions = @ (" ms-vscode.PowerShell" ) + $AdditionalExtensions
@@ -180,7 +183,7 @@ if (!($IsLinux -or $IsOSX)) {
180
183
}
181
184
182
185
if ($LaunchWhenDone ) {
183
- Write-Host " `n Installation complete, starting Visual Studio Code ...`n`n " - ForegroundColor Green
186
+ Write-Host " `n Installation complete, starting $appName ...`n`n " - ForegroundColor Green
184
187
& $codeCmdPath
185
188
}
186
189
else {
0 commit comments