title: How do I programmatically change a .lnk to change its target?
body: <p>Is there any way to open a windows shortcut (.lnk file) and change it's target? I found the following snippet which allows me to find the current target, but it's a read-only property:</p>
  
  <pre><code>Shell32::Shell^ shl = gcnew Shell32::Shell();
  String^ shortcutPos = "C:\\some\\path\\to\\my\\link.lnk";
  String^ lnkPath = System::IO::Path::GetFullPath(shortcutPos);
  Shell32::Folder^ dir = shl-&gt;NameSpace(System::IO::Path::GetDirectoryName(lnkPath));
  Shell32::FolderItem^ itm = dir-&gt;Items()-&gt;Item(System::IO::Path::GetFileName(lnkPath));
  Shell32::ShellLinkObject^ lnk = (Shell32::ShellLinkObject^)itm-&gt;GetLink;
  String^ target = lnk-&gt;Target-&gt;Path;
  </code></pre>
  
  <p>I can't find anything to alter the target. Is my only option to create a new shortcut to overwrite the current one? ..and if so, how do I do that?</p>