Get target of shortcut (.lnk) file with powershell : <p>I have a bunch of .lnk files and need to treat them differently depending on the target that the shortcut points to. I've found very little of how to this with other languages, but nothing about doing this with powershell.</p>

<p>I've tried this:</p>

<pre><code>$sh = New-Object -COM WScript.Shell
$target = $sh.CreateShortcut('&lt;path&gt;').Target
</code></pre>

<p>But this returns an empty string even though I can see in the .lnk properties that the Target is specified.</p>

<p>Any idea on how to accomplish this?</p>
