From 49e18cb6ca88127b437fa1ef02ea3a2c06e531f9 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 24 Aug 2024 04:18:33 +0200 Subject: [PATCH] Add a function for creating shortcuts --- scripts/Common/Scripts/System.ps1 | 21 +++++++++++++++++++ scripts/Windows/Software/RetroArch/Manage.ps1 | 6 ++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/Common/Scripts/System.ps1 b/scripts/Common/Scripts/System.ps1 index 71805ef5..2fa7db88 100644 --- a/scripts/Common/Scripts/System.ps1 +++ b/scripts/Common/Scripts/System.ps1 @@ -30,6 +30,27 @@ function Remove-DesktopIcon { } } +<# + .SYNOPSIS + Adds a new shortcut to the start menu. + + .PARAMETER Name + The name of the icon to create. + + .PARAMETER Target + The file to link to. +#> +function Add-StartMenuIcon { + param( + [string] $Name, + [string] $Target + ) + + Import-Module KnownFolders; + Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1"; + Install-ChocolateyShortcut -ShortcutFilePath "$((Get-KnownFolder "Common Programs").Path)/$Name.lnk" -TargetPath ((Get-Item $Target).FullName); +} + <# .SYNOPSIS Removes icons from the task bar. diff --git a/scripts/Windows/Software/RetroArch/Manage.ps1 b/scripts/Windows/Software/RetroArch/Manage.ps1 index 2667782c..578b6521 100644 --- a/scripts/Windows/Software/RetroArch/Manage.ps1 +++ b/scripts/Windows/Software/RetroArch/Manage.ps1 @@ -4,12 +4,14 @@ param( ) . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; +. "$PSScriptRoot/../../../Common/Scripts/System.ps1"; Start-SoftwareInstaller @PSBoundParameters ` -Installer { Install-ChocoPackage retroarch; - # ToDo: Add start menu shortcut - # ToDo: Add function for this purpose + } ` + -Configurator { + Add-StartMenuIcon "RetroArch" "C:\tools\RetroArch-Win64\retroarch.exe"; }; # ToDo: Add restoration