Skip to content

added functionality to install the VSCode context menus. #1238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 10, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions scripts/Install-VSCode.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#PSScriptInfo

.VERSION 1.1
.VERSION 1.2

.GUID 539e5585-7a02-4dd6-b9a6-5dd288d0a5d0

Expand All @@ -25,6 +25,7 @@
.EXTERNALSCRIPTDEPENDENCIES

.RELEASENOTES
21/03/2018 - added functionality to install the VSCode context menus. Also, VSCode is now always added to the search path
28/12/2017 - added functionality to support 64-bit versions of VSCode
& support for installation of VSCode Insiders Edition.
--
Expand Down Expand Up @@ -67,6 +68,9 @@
When present, causes Visual Studio Code to be launched as soon as installation
has finished.

.PARAMETER EnableContextMenus
When present, causes the installer to configure the Explorer context menus

.EXAMPLE
Install-VSCode.ps1 -Architecture 32-bit

Expand Down Expand Up @@ -126,7 +130,9 @@ param(
[ValidateNotNull()]
[string[]]$AdditionalExtensions = @(),

[switch]$LaunchWhenDone
[switch]$LaunchWhenDone,

[switch]$EnableContextMenus
)

if (!($IsLinux -or $IsOSX)) {
Expand Down Expand Up @@ -176,7 +182,12 @@ if (!($IsLinux -or $IsOSX)) {
Invoke-WebRequest -Uri "https://vscode-update.azurewebsites.net/latest/$($bitVersion)/$($BuildEdition)" -OutFile "$env:TEMP\vscode-$($BuildEdition).exe"

Write-Host "`nInstalling $appName..." -ForegroundColor Yellow
Start-Process -Wait "$env:TEMP\vscode-$($BuildEdition).exe" -ArgumentList /silent, /mergetasks=!runcode
if ($EnableContextMenus) {
Start-Process -Wait "$env:TEMP\vscode-$($BuildEdition).exe" -ArgumentList "/verysilent /tasks=addcontextmenufiles,addcontextmenufolders,addtopath"
}
else {
Start-Process -Wait "$env:TEMP\vscode-$($BuildEdition).exe" -ArgumentList "/verysilent /tasks=addtopath"
}
}
else {
Write-Host "`n$appName is already installed." -ForegroundColor Yellow
Expand All @@ -202,4 +213,4 @@ if (!($IsLinux -or $IsOSX)) {
}
else {
Write-Error "This script is currently only supported on the Windows operating system."
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add back in the final newline.