title: How do I find the target of a Windows App Execution Alias in C#/Win32 api?
body: <p>Microsft Windows Terminal (installed via the Microsoft Store) creates a 0 bytes <code>wt.exe</code> file which is a <a href="https://www.tiraniddo.dev/2019/09/overview-of-windows-execution-aliases.html" rel="noreferrer">Windows execution alias</a>. AFAIK it is somthing similar to a symbolic link, except it seems to be resolved at the <code>CreateProcess</code> Api level as opposed to a symlink that is translated at the file system.</p>
  
  <p>In powershell:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>❯ dir ~\AppData\Local\Microsoft\WindowsApps\wt.exe
  
  Mode    Name
  ----    ----
  la---   wt.exe -&gt; C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1401.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
  
  ❯ Get-Item .\wt.exe | fl
  
  Name           : wt.exe
  Length         : 0
  LinkType       : AppExeCLink
  Target         : C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1401.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
  </code></pre>
  
  <p>I wasn't able to find proper documentation for these "new" kind of aliases. Even googling PS <code>AppExeCLink</code> value is not very useful.</p>
  
  <p>I need a fast way to resolve an execution alias (get the target file) in a C# App. Given my requirements, I prefer an unmanaged (Win32 Api) way over adding a reference to the slow WMI or an external 300kb nuget package.</p>
  
  <p>Thanks!</p>