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.

Hier ein Auszug aus meinem Skript
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
Ü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.

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
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 881701733
Url: https://administrator.de/forum/powershell-shortcut-mit-parametern-881701733.html
Ausgedruckt am: 26.02.2025 um 19:02 Uhr
2 Kommentare
Neuester Kommentar