title: Creating a shortcut with command line arguments
body: <p>Using the code available on the link:
  <a href="http://msdn.microsoft.com/en-us/library/aa969393.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa969393.aspx</a></p>
  
  <pre><code>HRESULT CreateLink(LPCWSTR lpszPathObj1, LPCSTR lpszPathLink, LPCWSTR lpszDesc) 
  { 
      HRESULT hres; 
      IShellLink* psl; 
  
      // Get a pointer to the IShellLink interface. It is assumed that CoInitialize
      // has already been called.
      hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&amp;psl); 
      if (SUCCEEDED(hres)) 
      { 
          IPersistFile* ppf; 
  
          // Set the path to the shortcut target and add the description. 
          psl-&gt;SetPath(lpszPathObj1); 
          psl-&gt;SetDescription(lpszDesc); 
  
          // Query IShellLink for the IPersistFile interface, used for saving the 
          // shortcut in persistent storage. 
          hres = psl-&gt;QueryInterface(IID_IPersistFile, (LPVOID*)&amp;ppf); 
  
          if (SUCCEEDED(hres)) 
          { 
              WCHAR wsz[MAX_PATH]; 
  
              // Ensure that the string is Unicode. 
              MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH); 
  
              // Add code here to check return value from MultiByteWideChar 
              // for success.
  
              // Save the link by calling IPersistFile::Save. 
              hres = ppf-&gt;Save(wsz, TRUE); 
              ppf-&gt;Release(); 
          } 
          psl-&gt;Release(); 
      } 
      return hres; 
  }
  </code></pre>
  
  <p>I am trying to create a shortcut on the desktop, with a target (exe) that takes command line arguments.
  I have tried to set the target in the following ways:</p>
  
  <pre><code>LPCWSTR lpszPathObj1 = L"C:/Folder1/Folder2/SomeApp.exe 690080776072629&amp;734078";
  </code></pre>
  
  <p>Creates shortcut with Target:</p>
  
  <pre><code>"C:/Folder1/Folder2/SomeApp.exe 690080666072629&amp;782078"
  </code></pre>
  
  <p>And</p>
  
  <pre><code>LPCWSTR lpszPathObj1 = L"C:/Folder1/Folder2/SomeApp.exe\" 690080776072629&amp;734078";
  </code></pre>
  
  <p>Creates shortcut with blank target.</p>
  
  <p>I have tried more options, but not working. Could someone help?</p>