Strange wt.exe Windows Terminal Behavior

Strange wt.exe Windows Terminal Behavior

I’ve got to admit I love nothing better than a good Windows mystery. And right now: I seem to have a doozy on my hands. Here’s the deal: if I open Windows Terminal on my production Windows 10 PC, it won’t run another terminal instance (wt.exe) either in PowerShell or in a Command Prompt pane. You can see this in the lead-in graphic above. The PowerShell error message also provides profound guidance on what’s going on here with this strange wt.exe Windows Terminal behavior. Can you see it, too?

Why Get Strange wt.exe Windows Terminal Behavior?

The clue is in the error message text where it shows the path for the version of wt.exe that PowerShell or Command Prompt tries to run. It’s the Preview version, which I have installed alongside the production version on this — and only this — PC here at Chez Tittel. By no coincidence, it’s also the only machine here that’s having this problem.

That said: I’ve also found various workarounds that bypass this issue:

1. Providing the complete path spec for the non-preview version launches a new Terminal window fromĀ  Command Prompt. The complete path spec for the preview version still provokes “access denied.” It sits there and does nothing inside PowerShell.
2. Opening Voidtools Search Everything, right-clicking and selecting “Run as administrator” launches a new Terminal window for either version. The same approach works in File Explorer, too. Ditto for Start menu access (but only for the production version, which is the only one that has a Start menu entry).

Version Confusion Path Dynamics

To me, this problem seems obviously path related. And indeed, the first entry in the PATH variable on the affected PC reads:

C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_

That explains why the shell tries to run the Preview version in the first place when it’s called at the command line. It’s very likely a side-effect of the Terminal Preview installation process. I didn’t edit PATH to include it, that’s for sure.

And it turns out that when wt.exe runs, it adds itself to the PATH. This raises the question of why, even when I launch the production version, the Preview is the version added to the PATH. Interesting!

Workarounds Will Cover My Needs

For the time being I can get Terminal to do what I need it to do without completely figuring out this strange path dynamic that’s at work. I imagine that I could simply uninstall the Preview version and my issue would disappear. I’ll think about and fool around with this for a while yet, and see if I can figure another solution. For further discussion of what turns out to be a bigger mystery than I was expecting see this github issues thread: Windows terminal path is different if launched with wt.exe. This one appears to possess Dantean qualities (“Abandon all hope, ye who enter here…).

Let me be clear about this, though. This happens only on one of my near-dozen Windows PCs. And it’s the only one with both Preview and Production versions of Windows Terminal running side-by-side. It’s definitely a tempest of sorts, but one in a pretty small teapot.


Leave a Reply

Your email address will not be published. Required fields are marked *