Command prompt can't find windows terminal even though it detects the file's path
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?
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.