Shortcut with 2 entrys by Targetpath

Hello,

i would like to create a shortcut on the desktop and this goes fine with PSAPPDEP but my problem is that i would like use two entry on the Target path.

-TargetPath “C:\Windows\System32\runas.exe $envWinDir\system32\notepad.exe”

but with them i become errors in the logs and would like not be created.

i tried it with a variable to create this as:

[string]%PFAD = “C:\Windows\System32\runas.exe $envWinDir\system32\notepad.exe”

and then as -TargetPath $PFAD but there comes the same error too.

The Example in the documentation runs fine.

New-Shortcut -Path “$envProgramData\Microsoft\Windows\Start Menu\My Shortcut.lnk” -TargetPath “$envWinDir\system32\notepad.exe” -IconLocation “$envWinDir\system32\notepad.exe” -Description ‘Notepad’ -WorkingDirectory “$envHomeDrive$envHomePath”

anyone an idea? thanks a lot

André

Time for you to use New-Shortcut’s -Arguments parameter:

New-Shortcut -Path “$envProgramData\Microsoft\Windows\Start Menu\My Shortcut.lnk” -TargetPath “C:\Windows\System32\runas.exe” -Arguments “$envWinDir\system32\notepad.exe” -IconLocation “$envWinDir\system32\notepad.exe” -Description ‘Notepad’ -WorkingDirectory “$envHomeDrive$envHomePath”

PS: Watch out for you posting with slanted quotes and double quotes.