26

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

user3156459
  • 1,123
  • 2
  • 9
  • 17
  • What's the result of `where wt` in the command prompt? (Please edit your question accordingly) – Dominique Aug 07 '20 at 15:33
  • ... and `echo %USERPROFILE%`? – Dominique Aug 07 '20 at 15:34
  • 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 Aug 11 '20 at 15:16
  • 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? – Zach Pedigo Aug 11 '20 at 15:35
  • yes, installed from the store. also tried installing through ‘chocolatey’ - still no wt on the PATH. – user3156459 Aug 12 '20 at 17:48
  • manually add it to your path – apena Aug 17 '20 at 16:17
  • @apena you mean the full path to `wt.ext` as shown in Edit 3? – user3156459 Aug 18 '20 at 11:49

8 Answers8

90

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.

Brandon
  • 1,747
  • 17
  • 15
  • 2
    @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. – Brandon Jun 10 '21 at 20:57
  • 3
    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... – Daniel Ferreira Jul 26 '21 at 15:54
  • @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. – Brandon Jul 26 '21 at 17:03
  • 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. – John Aug 02 '21 at 09:27
  • 1
    @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. – Brandon Aug 05 '21 at 17:25
  • 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". – Benny Code Mar 19 '22 at 17:11
  • this doesn't work for me – Ooker Jun 14 '23 at 08:24
4

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

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

apena
  • 2,091
  • 12
  • 19
4

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.

Hope
  • 1,051
  • 13
  • 17
  • Thanks, I had the exact same problem and reinstalling worked fine. – Jammar May 31 '21 at 09:18
  • 1
    +1 but I had to reboot as well, attempting to install from github crashed, restart + another attempt to install it from MS Store worked. – nsimeonov Jun 01 '21 at 01:52
3

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.

chutz
  • 2,256
  • 2
  • 25
  • 38
  • 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" – Trismegistos Jul 29 '21 at 09:32
1

I was faced with the same issue, and only replacement of the

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

onto

C:\Users\<username>\AppData\Local\Microsoft\WindowsApps

in the PATH was helpful. Hope this will help someone who came here for the answer as me. This weird and it will why aliases don't work in env path, but windows store installer uses them.

sganabis
  • 155
  • 1
  • 8
  • Yes, I noted this in Edit 3 to the original question. The question is/was why %USERPROFILE% env. var. is not being picked up. – user3156459 Oct 02 '20 at 11:46
1

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.

Stuart Smith
  • 133
  • 5
  • 1
    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! – klm May 29 '21 at 12:04
0

I just repaired this bug following this steps:

Settings -> Apps -> Apps & Features -> Windows Terminal -> Advanced options -> Repair

ZetaDK
  • 31
  • 3
0

Been trying to figure this out as it happened randomly after a windows update. i followed a few procedures before and none worked until i tried this; Open an elevated CMD with Admin rights and run:

icacls "C:\Program Files\WindowsApps" /reset /t /c /q

It resets permissions on all the folders and files in the windows apps folder

from: https://github.com/microsoft/terminal/issues/7081

paszha
  • 1
  • 1