4

There are numerous Stack Overflow questions that ask a variant of this question; I've read through the first 10 or so, and none held the answer to my problem.

I'm trying to run wt.exe via command prompt.

wt
wt.exe

In both cases, it prints the error message:

The system cannot find the file C:\Users\MyUser\AppData\Local\Microsoft\WindowsApps\wt.exe.

It even does this if the current directory is C:\Users\MyUser\AppData\Local\Microsoft\WindowsApps.

Clearly it is finding the file since it figures out its path from any working directory. I have permissions on my own user's AppData, and--I checked--I have permissions on wt.exe itself. I've also tried it running as Administrator with the same results. Even running it from wt itself doesn't find it.

Running code-insiders works fine, and it is also in AppData. Running where wt returns the correct path.

What's strange is this works on my other computers, and I think it was working on this one before and actually stopped (I hadn't used it in a couple months).

Any ideas?

1 Answer 1

9

Objects under ~\AppData\Local\Microsoft\WindowsApps are not files – they are execution aliases, implemented through reparse points. They're a bit like symlinks or junctions, in that they they only point to another file within a specific application package, although they include some additional metadata about the package and they only support being executed but not opened.

But just as with symlinks or junctions, you would still see the link being present even if its target no longer exists – but you wouldn't be able to open it.

In this case, wt.exe is an execution alias that points into the Microsoft.WindowsTerminal package (or possibly into its "preview" variant). You should make sure that package is in fact installed:

Get-AppxPackage Microsoft.WindowsTerminal

If not, get it from the Microsoft Store app. If it is, try the usual "repair" command:

Get-AppxPackage Microsoft.WindowsTerminal | foreach {
    Add-AppxPackage -Register "$($_.InstallLocation)\appxmanifest.xml" -DisableDevelopmentMode
}

Or use the Settings app (at Apps → Apps and Features → App execution aliases) to disable and re-enable the "wt.exe" alias for the Windows Terminal package.

enter image description here

3
  • 2
    That last bit did the trick. Thanks!
    – dx_over_dt
    Commented Jun 11, 2021 at 18:55
  • The wt.exe alias stopped working after their most recent update. After trying all sorts of things, turning the alias off then on again worked. Never experience this rubbish in linux. Commented Aug 2, 2021 at 11:43
  • The link about Windows Execution Aliases you provided is a great analysis how this works in Windows. But why has MS implemented such a S**T, or is there a good reason why we would need this complicated way of executing an application in addition to what we already have?
    – Matt
    Commented Mar 3, 2023 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .