Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Targetpath for shortcuts

$
0
0

$shell = New-Object -ComObject WScript.Shell
$Location = "C:\Users\Public\Desktop"
$shortcut = $shell.CreateShortcut("$Location\Shift Management Tool.lnk")
$shortcut.TargetPath = "C:\Windows\explorer.exe \\mnd-fr01\med"
$shortcut.WorkingDirectory = "C:\Windows"
$shortcut.Save()

The above code "almost works"  It creates the shortcut but it only places 1 backslash instead of 2.   I've tried wrapping my Targetpath in different things too (`  *  " ) etc.... and I have yet to make it work.    How do I code this so the TargetPath will have both backslashes?

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles