title: .TargetPath doesn't seem to take Variables?
body: <p>I'm trying to create a Shortcut to a Folder using the Powershell ISE, and appareantly, opposed to all examples I've found, <code>$Shortcut.TargetPath</code> does not seem to want to be assigned a variable, or interact with one.</p>
  
  <p>I've attempted to use literal Paths in Quotation Marks (<code>$Shortcut.TargetPath = "\\thisis\where\the\path\goes\"</code>), which seem to work, however as soon as I use a variable it simply turns to a null <code>($Shortcut.TargetPath = $TargetDir)</code>.</p>
  
  <p>I've tried to add it, I've tried to write a value first with quotation marks and then overwrite that value, I've tried to write a value with quotation marks and then add to that value, it always turns to null.</p>
  
  <pre><code>$WScriptShell = New-Object -ComObject WScript.Shell
  
  $TargetDir = "D:\Files\"
  $SourceDir = "C:\Windows\"
  
  $Shortcutid1 = $TargetDir + '.lnk'
  $Shortcutid = $SourceDir + '.lnk'
  
  $Shortcut = $WScriptShell.CreateShortcut($Shortcutid1)
  $Shortcut.TargetPath = $TargetDir
  $Shortcut.TargetPath
  $TargetDir
  
  $Shortcut1 = $WScriptShell.CreateShortcut($Shortcutid)
  $Shortcut1.TargetPath = "C:\Windows\"
  $Shortcut1.TargetPath
  </code></pre>
  
  <p>Now, what I'd excpect to happen, would be this:</p>
  
  <pre><code>D:\Files\
  D:\Files\
  C:\Windows\
  </code></pre>
  
  <p>Instead, I get the output:</p>
  
  <pre><code>D:\Files\
  C:\Windows\
  </code></pre>
  
  <p>The line of <code>$Shortcut.TargetPath</code> is just empty, but not null.</p>
  
  <p>I tested it with <code>if([string]::IsNullOrEmpty($Shortcut.TargetPath)) {"empty"} else {"wat"}</code>, and it the output is <code>wat</code>, so weirdly enough, there seems to at least be something in there?
  Edit: Powershell Version is Version 5.1.17763.503 </p>