The environment variables of "Open in Windows Terminal" and "Manually Start Windows Terminal" are inconsistent. #16900

Closed
opened 2026-01-31 05:26:39 +00:00 by claunia · 10 comments
Owner

Originally created by @TigerBeanst on GitHub (Mar 1, 2022).

Windows Terminal version

1.11.3471.0

Windows build number

10.0.22000.0

Other Software

No response

Steps to reproduce

First, add D:\DHYProjects\Las2Osgt\osg; to Path in environment variable.

image

  1. Right click in Explorer, then click "Open in Windows Terminal"(Chinese: 在 Windows 终端中打开

Mark as WT1:
image

and Manually Start Windows Terminal, mark as WT2:

image

  1. Check Path environment variable:

image

Expected Behavior

Their values should be exactly the same.

Actual Behavior

I can't find D:\DHYProjects\Las2Osgt\osg in WT1, which is started by right-click in explorer.

I have trid to kill explorer.exe and restart it in Task Manager. It doesn't work.

It looks like I'll have to reboot my computer to get it work.

Originally created by @TigerBeanst on GitHub (Mar 1, 2022). ### Windows Terminal version 1.11.3471.0 ### Windows build number 10.0.22000.0 ### Other Software _No response_ ### Steps to reproduce First, add `D:\DHYProjects\Las2Osgt\osg;` to `Path` in environment variable. ![image](https://user-images.githubusercontent.com/3889846/156134200-66fd385e-0c03-4156-ac0b-80677fea856c.png) 1. Right click in Explorer, then click "Open in Windows Terminal"(Chinese: `在 Windows 终端中打开`) Mark as **_WT1_**: ![image](https://user-images.githubusercontent.com/3889846/156132135-5be7ac4e-3774-4cf3-bbbb-011868533392.png) and Manually Start Windows Terminal, mark as **_WT2_**: ![image](https://user-images.githubusercontent.com/3889846/156133665-c74792ed-6102-4b90-a022-f3212a048c20.png) 2. Check `Path` environment variable: ![image](https://user-images.githubusercontent.com/3889846/156134351-63964d45-6b0c-4f91-9fc3-7aaa8f4865bf.png) ### Expected Behavior Their values should be exactly the same. ### Actual Behavior I can't find `D:\DHYProjects\Las2Osgt\osg` in **_WT1_**, which is started by right-click in explorer. I have trid to kill explorer.exe and restart it in Task Manager. It doesn't work. _It looks like I'll have to reboot my computer to get it work._
Author
Owner

@wkl007 commented on GitHub (Mar 5, 2022):

I have the same issue

@wkl007 commented on GitHub (Mar 5, 2022): I have the same issue
Author
Owner

@zadjii-msft commented on GitHub (Mar 7, 2022):

  • Is the Terminal already running when you open a new tab via the Explorer context menu? (If so, this is probably a riff on #1125).
  • If this is a "cold launch" (there aren't any other running Terminal windows), then this is something else. #11777 looks a bit related, so does #12545
@zadjii-msft commented on GitHub (Mar 7, 2022): * Is the Terminal already running when you open a new tab via the Explorer context menu? (If so, this is probably a riff on #1125). * If this is a "cold launch" (there aren't any other running Terminal windows), then this is something else. #11777 looks a bit related, so does #12545
Author
Owner

@ghost commented on GitHub (Mar 11, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Mar 11, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@TigerBeanst commented on GitHub (Mar 12, 2022):

Is the Terminal already running when you open a new tab via the Explorer context menu?
No. I closed all Terminal windows and try it.

A screenrecord:
https://drive.google.com/file/d/1CKwLFEboC46t7Na4dYGSk8XcpTQJFLib/view?usp=sharing

@TigerBeanst commented on GitHub (Mar 12, 2022): > * Is the Terminal already running when you open a new tab via the Explorer context menu? (If so, this is probably a riff on [Feature Request: Terminal should listen for the WM_SETTINGCHANGE for environment variable updates #1125](https://github.com/microsoft/terminal/issues/1125)). > * If this is a "cold launch" (there aren't any other running Terminal windows), then this is something else. [Windows terminal path is different if launched with wt.exe #11777](https://github.com/microsoft/terminal/issues/11777) looks a bit related, so does [Open alias "wt" have unexpected behavior. #12545](https://github.com/microsoft/terminal/issues/12545) **Is the Terminal already running when you open a new tab via the Explorer context menu?** No. I closed all Terminal windows and try it. A screenrecord: https://drive.google.com/file/d/1CKwLFEboC46t7Na4dYGSk8XcpTQJFLib/view?usp=sharing
Author
Owner

@stzb321 commented on GitHub (Sep 5, 2022):

the issue still not been fixed

@stzb321 commented on GitHub (Sep 5, 2022): the issue still not been fixed
Author
Owner

@MrDach commented on GitHub (Sep 26, 2022):

Any updates on this? It's slightly annoying having to open Terminal via the start menu and having to navigate to the folder every time.

@MrDach commented on GitHub (Sep 26, 2022): Any updates on this? It's slightly annoying having to open Terminal via the start menu and having to navigate to the folder every time.
Author
Owner

@madmax91 commented on GitHub (Oct 11, 2022):

This is what worked for me to fix this issue:
Go to Settings > Apps > Apps & Features > Terminal and click on Terminate, this will kill all the Terminal processes and related processes and will refresh the cached variables I suppose. After this even if I launch the Terminal from context menu it has the correct variables loaded.

It looks like that windows allows this app and its processes to run in the background even after you close the window. So if you closed the window and changed some Environment variables if any of these processes are left running in the background it will not refresh them fully. It is still strange as why it is refreshing the variables for the instance launched via start menu but not for the instance that is launched via context menu.

@madmax91 commented on GitHub (Oct 11, 2022): This is what worked for me to fix this issue: Go to Settings > Apps > Apps & Features > Terminal and click on Terminate, this will kill all the Terminal processes and related processes and will refresh the cached variables I suppose. After this even if I launch the Terminal from context menu it has the correct variables loaded. It looks like that windows allows this app and its processes to run in the background even after you close the window. So if you closed the window and changed some Environment variables if any of these processes are left running in the background it will not refresh them fully. It is still strange as why it is refreshing the variables for the instance launched via start menu but not for the instance that is launched via context menu.
Author
Owner

@bestK commented on GitHub (Oct 28, 2022):

If you use autohotkey, see https://github.com/microsoft/terminal/issues/8862#issuecomment-1294499276

@bestK commented on GitHub (Oct 28, 2022): If you use autohotkey, see https://github.com/microsoft/terminal/issues/8862#issuecomment-1294499276
Author
Owner

@TheComputerM commented on GitHub (Oct 30, 2022):

Having the same problem with pnpm. Opening the terminal from the start menu works properly but opening the terminal from the right click context menu will not have PNPM_HOME environment variable set correctly.

@TheComputerM commented on GitHub (Oct 30, 2022): Having the same problem with pnpm. Opening the terminal from the start menu works properly but opening the terminal from the right click context menu will not have `PNPM_HOME` environment variable set correctly.
Author
Owner

@zadjii-msft commented on GitHub (Mar 24, 2023):

This almost certainly was resolved by #14999.

Yep, I just checked this on a fresh off main build of the Terminal, and this looks fixed to me. This'll be fixed in 1.18, which should be coming out sometime Q2-ish. That's about as accurate as I can be with a release date. Thanks all!

@zadjii-msft commented on GitHub (Mar 24, 2023): This almost certainly was resolved by #14999. Yep, I just checked this on a fresh off `main` build of the Terminal, and this looks fixed to me. This'll be fixed in 1.18, which should be coming out sometime Q2-ish. That's about as accurate as I can be with a release date. Thanks all!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16900