Add a function for creating shortcuts

This commit is contained in:
Manuel Thalmann 2024-08-24 04:18:33 +02:00
parent 1c45b5e746
commit 49e18cb6ca
2 changed files with 25 additions and 2 deletions

View file

@ -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 .SYNOPSIS
Removes icons from the task bar. Removes icons from the task bar.

View file

@ -4,12 +4,14 @@ param(
) )
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; . "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/System.ps1";
Start-SoftwareInstaller @PSBoundParameters ` Start-SoftwareInstaller @PSBoundParameters `
-Installer { -Installer {
Install-ChocoPackage retroarch; 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 # ToDo: Add restoration