ask user to create a desktop shortcut

This commit is contained in:
Mylloon 2024-04-01 15:27:12 +02:00
parent 067ca081b7
commit 5f8eaf36fb
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -22,3 +22,17 @@ $Shortcut.Save()
# Add new app to registry # Add new app to registry
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v DisplayName /t REG_SZ /d "DSR" REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v DisplayName /t REG_SZ /d "DSR"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v InstallLocation /t REG_SZ /d "$env:LOCALAPPDATA\DSR" 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?",
@(
[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
$Shortcut = $WshShell.CreateShortcut("$env:HOMEPATH\Desktop\DSR.lnk")
$Shortcut.TargetPath = "$env:LOCALAPPDATA\DSR\dsr.exe"
$Shortcut.Save()
}