From 4275cb5528f4b408a01e5f9787b2f796e5aaff7c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 17 May 2024 19:25:09 +0200 Subject: [PATCH] Add update switch --- install.ps1 | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/install.ps1 b/install.ps1 index b785e7f..f29d783 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,3 +1,7 @@ +param ( + [switch]$update +) + # Enable TLSv1.2 for compatibility with older clients [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 @@ -24,16 +28,18 @@ REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v Dis REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v InstallLocation /t REG_SZ /d "$env:LOCALAPPDATA\DSR" # Ask user to add a shortcut to the desktop -if ($Host.UI.PromptForChoice( - "***********************", - "Add a desktop shortcut?", - @( +if (-not $update) { + if ($Host.UI.PromptForChoice( + "***********************", + "Add a desktop shortcut?", + @( [System.Management.Automation.Host.ChoiceDescription]::new("&Yes", "Add a shortcut to your desktop.") [System.Management.Automation.Host.ChoiceDescription]::new("&No", "Skip the shortcut creation.") - ), 1) -eq 0) { - $WshShell = New-Object -comObject WScript.Shell - $Desktop = [Environment]::GetFolderPath("Desktop") - $Shortcut = $WshShell.CreateShortcut("$Desktop\DSR.lnk") - $Shortcut.TargetPath = "$env:LOCALAPPDATA\DSR\dsr.exe" - $Shortcut.Save() + ), 1) -eq 0) { + $WshShell = New-Object -comObject WScript.Shell + $Desktop = [Environment]::GetFolderPath("Desktop") + $Shortcut = $WshShell.CreateShortcut("$Desktop\DSR.lnk") + $Shortcut.TargetPath = "$env:LOCALAPPDATA\DSR\dsr.exe" + $Shortcut.Save() + } }