cmder/vendor/bin/set-shortcut.ps1

22 lines
516 B
PowerShell
Raw Permalink Normal View History

2023-03-15 20:45:01 +08:00
[CmdletBinding()]
param(
[Parameter()]
[string]$SourceExe,
[string]$Arguments,
[string]$DestinationPath,
[string]$WorkingDirectory,
[String]$IconLocation
)
if ($IconLocation -eq '') {
$IconLocation = $SourceExe
}
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($destinationPath)
$Shortcut.TargetPath = $SourceExe
$Shortcut.Arguments = $Arguments
$shortcut.WorkingDirectory = $WorkingDirectory
$shortcut.IconLocation = $IconLocation
$Shortcut.Save()