PowerShell/Scripts/install-visual-studio-code.ps1

26 lines
583 B
PowerShell
Raw Normal View History

2021-08-30 16:12:11 +02:00
<#
.SYNOPSIS
2022-07-15 17:12:01 +02:00
Installs Visual Studio Code
2021-08-30 16:12:11 +02:00
.DESCRIPTION
2022-07-15 17:12:01 +02:00
This PowerShell script installs Visual Studio Code.
2021-08-30 16:12:11 +02:00
.EXAMPLE
2022-07-15 17:12:01 +02:00
PS> ./install-visual-studio-code
.LINK
https://github.com/fleschutz/PowerShell
2021-08-30 16:12:11 +02:00
.NOTES
2022-07-15 17:12:01 +02:00
Author: Markus Fleschutz | License: CC0
2021-08-30 16:12:11 +02:00
#>
try {
2022-07-15 17:12:01 +02:00
"Installing Visual Studio Code, please wait..."
2021-08-30 16:12:11 +02:00
2022-07-15 17:12:01 +02:00
& winget install --id Microsoft.VisualStudioCode --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
2021-08-30 16:12:11 +02:00
2022-07-15 17:12:01 +02:00
"Visual Studio Code installed successfully."
exit 0 # success
} catch {
"Sorry: $($Error[0])"
exit 1
2021-08-30 16:12:11 +02:00
}