ralus67
Goto Top

Powershell Shortcut mit Parametern

Hallo Community

Über einen Powershell Skript muss ich einen Shortcut erstellen. Die Exe Datei ruft hier noch eine Config Datei. Wenn ich das im Shell angeben ist das Ziel leer. Es scheint so, als ob die Parameter nicht erkannt werden.

shortcut

Hier ein Auszug aus meinem Skript
$DestinationFolder = "${env:ProgramFiles(x86)}\XMing\"  
$ExeFile = "${env:ProgramFiles(x86)}\XMing\XLaunch.exe"  
$Application = "argos-artemis.xlaunch"  
$IconLocation = "$DestinationFolder\XLaunch.exe"  
$IconIndex = "0"  

$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$LinkPath\$Link")  
$Shortcut.IconLocation = "$IconLocation, $IconIndex"  
**$Shortcut.TargetPath = "$ExeFile -run $DestinationFolder\$Application"**  
$Shortcut.WorkingDirectory = "$DestinationFolder"  
$Shortcut.Save()

Was ist im Shortcut.TargetPath falsch? Gibt es irgend einen Befehl für Shortcut "command line parameter"?

Im Voraus vielen Dank für Eure Hilfe

Content-Key: 881701733

Url: https://administrator.de/contentid/881701733

Printed on: April 20, 2024 at 02:04 o'clock

Member: colinardo
Solution colinardo Jul 02, 2021 updated at 09:13:25 (UTC)
Goto Top
Für Argumente gibt es die "Arguments" Property ...
#...
$Shortcut.TargetPath = $ExeFile
$shortcut.Arguments = "-run `"$DestinationFolder\$Application`""  
# ...
Grüße Uwe
Member: Ralus67
Ralus67 Jul 02, 2021 at 09:48:14 (UTC)
Goto Top
Danke für die Hilfe.

Das war die Lösung.