Windows Terminal's wt.exe cannot be found for non-admin user's PATH

18,044

Solution 1

TLDR: Try opening the App execution aliases settings page in Windows 10 and toggle the switch for Windows Terminal off and then back on again.

I'm not sure if this is exactly the same issue as in the original question, but I randomly just had issues with the wt command not working (either when I typed it into the Start Menu and pressed enter, or when I typed it into the address bar of File Explorer to try to open a terminal in the current directory). If I manually clicked Windows Terminal in the start menu or opened the Microsoft Store page for it and clicked the "Launch" button, then it would work. My path environment variable was in order and I didn't have the Windows Terminal Preview installed---just Windows Terminal.

After Googling around some, I found something that mentioned the "App execution aliases" settings page in windows 10. I opened that and toggled the switch off, at which point I saw the %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\wt.exe file disappear. Then I toggled it back on and wt.exe reappeared in that folder. After doing that, everything works fine again.

Solution 2

In my case wt.exe had zero size after a reboot, and I was getting the message above when trying to run it. I was still able to open Windows Terminal from Start Menu.

Reinstalling the application from MS Store fixed the problem.

Backup your settings file (%userprofile%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json) beforehand, as it will be overwritten with the default.

Solution 3

Try adding an environment variable for your Path, let the value be:

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

Solution 4

A different method that worked for me is:

  1. Delete %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\wt.exe
  2. Go to Settings ➡ Apps ➡ Apps & Features ➡ Windows Terminal ➡ Advanced options ➡ Repair

The last step recreated the wt.exe and it worked after that.

P.S. I just noticed that this is a more convoluted way of accomplishing Brandon's answer.

Solution 5

I have a similar problem. However, when I opened %USERPROFILE%\AppData\Local\Microsoft\WindowsApps, I discovered that wt.exe was not in that path. I suspect the reason was that I've installed both Windows Terminal and Windows Terminal Preview as I have a folder for each, i.e. Microsoft.WindowsTerminal_ and Microsoft.WindowsTerminalPreview_.

I cheated my way out of this by using GnuWin32 utilities ( ln.exe ) to create a symbolic link to the Windows Terminal Preview of wt.exe ( both of which have a size of 0 bytes, for some reason? ) named wt.exe in the WindowsApps folder.

I checked using the Advanced System Properties-->Environment Variables and using env | findstr /i WindowsApps to make sure that the expected value was in the path. Afterwards, using wt.exe functioned as expected.

I know this seems like a very obvious gotcha, but this resolved my headache - at least for now.

Share:
18,044

Related videos on Youtube

user3156459
Author by

user3156459

Updated on June 04, 2022

Comments

  • user3156459
    user3156459 almost 2 years

    Windows 10 with a non-admin user account.

    Installed Windows Terminal from Microsoft Windows Apps. Calling wt.exe from cmd.exe can't find it. Running Windows Terminal from the Start using short-cut opens it OK.

    Running wt.exe in cmd.exe from admin account opens it successfully. PATH variable has the non-admin user's relevant entry: %USERPROFILE%\AppData\Local\Microsoft\WindowsApps which has wt.exe in it. Clicking on it in Explorer opens Windows Terminal.

    Outputs of where and echo from within cmd.exe:

    C:\Users\sr>wt
    'wt' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\Users\sr>where wt
    INFO: Could not find files for the given pattern(s).
    
    C:\Users\sr>echo %USERPROFILE%
    C:\Users\sr
    
    

    How do I open Windows Terminal from cmd.exe using wt.ext from non-admin account?

    Edit: all commands are run from within cmd.exe
    Edit 2: wt.exe also fails to launch from Powershell, both standard and admin: standard:

    PS C:\Users\sr> wt
    wt : The term 'wt' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
    or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + wt
    + ~~
        + CategoryInfo          : ObjectNotFound: (wt:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

    admin

    PS C:\WINDOWS\system32> wt
    Program 'wt.exe' failed to run: The file cannot be accessed by the systemAt line:1 char:1
    + wt
    + ~~.
    At line:1 char:1
    + wt
    + ~~
        + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
        + FullyQualifiedErrorId : NativeCommandFailed
    

    Edit 3: in cmd.exe, typing full path to wt.exe launches it OK: C:\Users\sr>C:\Users\sr\AppData\Local\Microsoft\WindowsApps\wt.exe

    • Dominique
      Dominique over 3 years
      What's the result of where wt in the command prompt? (Please edit your question accordingly)
    • Dominique
      Dominique over 3 years
      ... and echo %USERPROFILE%?
    • Zach Pedigo
      Zach Pedigo over 3 years
      This looks like it could mean that the entry in your PATH is incorrect. It could also be that your PATH has too many entries. Try creating a new environment variable called TERMINAL and associate the path to wt.exe just like you did above. Then add %TERMINAL% to your PATH.
    • Zach Pedigo
      Zach Pedigo over 3 years
      It could also be that windows terminal did not add the necessary path entries for your user. The command "wt" should have been added once you installed windows terminal. Did you install from the store?
    • user3156459
      user3156459 over 3 years
      yes, installed from the store. also tried installing through ‘chocolatey’ - still no wt on the PATH.
    • apena
      apena over 3 years
      manually add it to your path
    • user3156459
      user3156459 over 3 years
      @apena you mean the full path to wt.ext as shown in Edit 3?
  • user3156459
    user3156459 over 3 years
    %USERPROFILE%\AppData\Local\Microsoft\WindowsApps is already in the PATH
  • user3156459
    user3156459 over 3 years
    Yes, I noted this in Edit 3 to the original question. The question is/was why %USERPROFILE% env. var. is not being picked up.
  • klm
    klm almost 3 years
    I found this answer when the error suddenly started happening to me. I saw that I also had both Windows Terminal and Windows Terminal Preview installed from the Windows App Store. I also saw that Windows Terminal Preview had been updated this morning, so I uninstalled it (using right click menu on the Windows Terminal Preview Start Menu entry), and the problem Went Away - phew. Thanks for the lead!
  • Jammar
    Jammar almost 3 years
    Thanks, I had the exact same problem and reinstalling worked fine.
  • nsimeonov
    nsimeonov almost 3 years
    +1 but I had to reboot as well, attempting to install from github crashed, restart + another attempt to install it from MS Store worked.
  • Brandon
    Brandon almost 3 years
    @R.Joiny Glad to have saved you a bit of time. =) Random side note: I can't help thinking about the IT Crowd every time I see the way I worded the TLDR... "Have you tried turning it off and on again?" It's just a bit harder to find exactly what you need to turn off and on again in this case, as rebooting didn't actually help in my case.
  • Daniel Ferreira
    Daniel Ferreira almost 3 years
    Magically works for me too. Just toggled it under Manage app execution aliases and worked. wt.exe got missing for me after a reboot for a Patch Tuesday. Let's see if this happens again...
  • Brandon
    Brandon almost 3 years
    @DanielFerreira Yep, I just had it break a second time (undoubtedly due to Windows updates). I kept hitting the windows key, typing "wt", and pressing enter to open Windows Terminal---and nothing would happen. I had to go toggle it again to fix it for the second time.
  • Trismegistos
    Trismegistos over 2 years
    In my case I could not delete "%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\wt.exe" evan as an admin. I got error "wt.exe the file cannot be accessed by the system"
  • John
    John over 2 years
    This worked for me as well! I've previously installed Windows Terminal using Chocolatey choco install microsoft-windows-terminal and yesterday got this problem. Not sure if it's related to Chocolatey or Windows Update though.
  • Brandon
    Brandon over 2 years
    @John My guess is it's caused by Windows Update since I don't use Chocolatey and have had it happen twice now around the same time updates rolled out. I did try Chocolately briefly years ago, but ended up sticking with Ninite even though it has a much more limited selection of programs.
  • Albena Kertova
    Albena Kertova over 2 years
    @Brandon, Thank you for the magic, this worked!
  • Benny Neugebauer
    Benny Neugebauer about 2 years
    The "Windows Terminal" wasn't listed in "Manage app execution aliases". I had to start it first manually via the search and then it showed up in "Manage app execution aliases".