title: Win-PS2EXE - Respect the location of the resulting executable
body: <p>Take these settings for the program <strong><a href="https://gallery.technet.microsoft.com/PS2EXE-GUI-Convert-e7cb69d5" rel="nofollow noreferrer">Win-PS2EXE</a></strong>:</p>
  
  <p>This is so that the console will show when the <code>exe</code> file is clicked on.</p>
  
  <p><a href="https://i.stack.imgur.com/iZ9es.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iZ9es.png" alt="Win-PS2EXE"></a></p>
  
  <p>And this code:</p>
  
  <pre><code>$inf_file = "$PSScriptRoot\setup-files\install.inf"
  write-host """$inf_file"""
  timeout 10
  </code></pre>
  
  <p>Let us say that the path of the new executable is <code>W:\Apps\Install Scheme.exe</code></p>
  
  <p>Which means the <code>$inf_file</code> is here <code>W:\Apps\setup-files\install.inf</code></p>
  
  <hr>
  
  <p>When I click the converted exe file I get this.</p>
  
  <p><a href="https://i.stack.imgur.com/UoOwo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UoOwo.png" alt="enter image description here"></a></p>
  
  <p>Is there any way to get the correct path of <code>W:\Apps\setup-files\install.inf</code> so that the executable recognises the location of itself when clicked.</p>
  
  <p>I thought that <code>$PSScriptRoot</code> would work.</p>
  
  <p>I'm lost as to how to get around this as the exe file will eventually depend on knowing its location.</p>