title: How to create link for executable file and indicate work folder in batch or VBS?
body: <p>OS: Windows 7</p>
  
  <p>I am trying to create a link to the desktop folder via batch like this:</p>
  
  <pre><code>mklink "%userprofile%\Desktop\MyExe" "%~dp0\MyExe.exe" 
  </code></pre>
  
  <p>The command worked, but how to indicate <code>MyExe.exe</code> execute at <code>"%~dp0"</code>? 
  <code>MyExe.exe</code> looks like run at the current folder, so it can't load my config file.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Got the different problem by using VBS, run code in below will create a shortcut
  for <code>C:\Users\jiu\Desktop\MyExe.exe</code>, But I want <code>MyExe.exe</code>.</p>
  
  <pre class="lang-vbs prettyprint-override"><code>Set oWS = WScript.CreateObject("WScript.Shell")
  userProfilePath = oWS.ExpandEnvironmentStrings("%UserProfile%")
  currParentFolder = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
  linkPath = userProfilePath + "\Desktop\MyExe.LNK"
  Set oLink = oWS.CreateShortcut(linkPath)
      oLink.TargetPath = "MyExe.exe" 
      oLink.WorkingDirectory = currParentFolder
  oLink.Save
  </code></pre>