title: Variables in Shortcut Arguments ignored for Visual Studio setup project
body: <p>I was looking for an alternative for an uninstall in a setup project (while reading <a href="https://stackoverflow.com/questions/1356160/in-a-visual-studio-setup-project-how-do-i-generate-an-uninstall-script">this</a>) and tried the following, which sadly fails:</p>
  
  <p>I made a Setup Project for a dummy application in C#. I added the output from its build and an Uninstall.bat file with this inside:</p>
  
  <pre><code>echo %1
  msiexec /x %1
  </code></pre>
  
  <p>I then added a shortcut to that file with <code>[Product Code]</code> in the shortcut's Arguments field:</p>
  
  <p><img src="https://i.stack.imgur.com/Cz4DR.jpg" alt="Shortcut"></p>
  
  <p>My rationale was that Uninstall.bat would be called with the product code (resolved) as an argument.</p>
  
  <p>After setting that up, no dice, the argument isn't passed along to the installer from the shortcut. The output from the command window is:</p>
  
  <pre>
  ECHO is on.
  msiexec /x
  </pre>
  
  <p>The <code>%1</code> parameter doesn't seem present. Looking inside the LNK file in a binary editor, the product code appears to be present.</p>
  
  <p>What's happening here?</p>
  
  <p>Further attempts for various arguments and a simple echo:</p>
  
  <ol>
  <li><code>[Product Code]</code>  -> ignored</li>
  <li><code>{%hardcodedProductCode%}</code> -> passed to batch as <code>%1</code></li>
  <li><code>[Product Name]</code>  -> ignored</li>
  <li><code>Constant [Product Code]</code> -> Constant only is passed to batch as <code>%1</code></li>
  <li><code>[Product Name] Constant [Product Code]</code> -> Constant only is passed to batch as <code>%1</code>, not <code>%2</code></li>
  <li><code>[Product Name] Constant [Product Code] [UndeclaredVariable123]</code> -> Constant only is passed to batch as <code>%1</code></li>
  <li><code>$[Product Code]</code> -> <code>$</code> only is passed to batch as <code>%1</code></li>
  </ol>
  
  <p>The 5th example shows that variables are ignored somehow if the constant is bumped to position 1.</p>