@@ -4,7 +4,12 @@ function create_startmenu_shortcuts($manifest, $dir, $global, $arch) {
4
4
$shortcuts | ? { $_ -ne $null } | % {
5
5
$target = $_.item (0 )
6
6
$name = $_.item (1 )
7
- startmenu_shortcut " $dir \$target " $name $global
7
+ try {
8
+ $arguments = $_.item (2 )
9
+ } catch {
10
+ $arguments = " "
11
+ }
12
+ startmenu_shortcut " $dir \$target " $name $global $arguments
8
13
}
9
14
}
10
15
@@ -16,7 +21,7 @@ function shortcut_folder($global) {
16
21
" $ ( [environment ]::getfolderpath(' startmenu' )) \Programs\Scoop Apps"
17
22
}
18
23
19
- function startmenu_shortcut ($target , $shortcutName , $global ) {
24
+ function startmenu_shortcut ($target , $shortcutName , $global , $arguments ) {
20
25
if (! (Test-Path $target )) {
21
26
Write-Host -f DarkRed " Creating shortcut for $shortcutName ($ ( fname $target ) ) failed: Couldn't find $target "
22
27
return
@@ -25,9 +30,19 @@ function startmenu_shortcut($target, $shortcutName, $global) {
25
30
if (! (Test-Path $scoop_startmenu_folder )) {
26
31
New-Item $scoop_startmenu_folder - type Directory
27
32
}
33
+ $dirname = [System.IO.Path ]::GetDirectoryName($shortcutName )
34
+ if ($dirname ) {
35
+ $dirname = [io.path ]::combine($scoop_startmenu_folder , $dirname )
36
+ if (! (Test-Path $dirname )) {
37
+ New-Item $dirname - type Directory
38
+ }
39
+ }
28
40
$wsShell = New-Object - ComObject WScript.Shell
29
41
$wsShell = $wsShell.CreateShortcut (" $scoop_startmenu_folder \$shortcutName .lnk" )
30
42
$wsShell.TargetPath = " $target "
43
+ if ($arguments ) {
44
+ $wsShell.Arguments = $arguments
45
+ }
31
46
$wsShell.Save ()
32
47
write-host " Creating shortcut for $shortcutName ($ ( fname $target ) )"
33
48
}
0 commit comments