Enable setting both Starting directory and Use parent process directory #19585

Closed
opened 2026-01-31 06:47:59 +00:00 by claunia · 4 comments
Owner

Originally created by @weitzhandler on GitHub (Mar 27, 2023).

Issue

Many times, while using Windows Explorer I'd want to open the terminal in my current location by typing wt in the address bar.

However, this will not work if I set the 'Starting directory' option to my preferred folder.

Proposal

One potential solution could be to enable setting both Starting directory and Use parent process directory and use them as two independent options where if there's a parent process and the "Use parent process directory" option is true, the process should start in that location regardless of the regular Starting directory.

image

image

Originally created by @weitzhandler on GitHub (Mar 27, 2023). # Issue Many times, while using Windows Explorer I'd want to open the terminal in my current location by typing _wt_ in the address bar. However, this will not work if I set the 'Starting directory' option to my preferred folder. # Proposal One potential solution could be to enable setting both Starting directory and Use parent process directory and use them as two independent options where if there's a parent process and the "Use parent process directory" option is true, the process should start in that location regardless of the regular Starting directory. ![image](https://user-images.githubusercontent.com/2716316/228039107-022219be-24d3-49bf-88aa-06727eaac4f4.png) ![image](https://user-images.githubusercontent.com/2716316/228039246-30b23894-c8af-40c0-998e-56e2d8555bac.png)
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-Fix labels 2026-01-31 06:47:59 +00:00
Author
Owner

@DHowett commented on GitHub (Mar 27, 2023):

Thanks for the request!

if there's a parent process

Unfortunately, there's always a parent process. We did an early investigation into detecting whether we had inherited a useful starting directory or a stupid less useful one, but it turns out that (1) users might legitimately want to start in system32 and (2) the platform offers no way for us to tell, honestly, whether we got started somewhere on purpose or accidentally.

It's not great and probably not satisfying, as answers go, but... ☹️

@DHowett commented on GitHub (Mar 27, 2023): Thanks for the request! > if there's a parent process Unfortunately, there's **always** a parent process. We did an early investigation into detecting whether we had inherited a _useful_ starting directory or a ~~stupid~~ less useful one, but it turns out that (1) users might legitimately want to start in `system32` and (2) the platform offers no way for us to tell, honestly, whether we got started somewhere on purpose or accidentally. It's not great and probably not _satisfying_, as answers go, but... ☹️
Author
Owner

@weitzhandler commented on GitHub (Mar 27, 2023):

Is there any way to make it work?
I also use WT as my default VS CLI (when pressing Alt+Enter in Solution Explorer) and face the same issue when the original path is lost.

I'm curious, when someone opens WT from VS or from the browser, aren't any arguments passed in? Perhaps we can inspect those and if there are any set them as priority over default location?

@weitzhandler commented on GitHub (Mar 27, 2023): Is there any way to make it work? I also use WT as my default VS CLI (when pressing <kbd>Alt</kbd>+<kbd>Enter</kbd> in Solution Explorer) and face the same issue when the original path is lost. I'm curious, when someone opens WT from VS or from the browser, aren't any arguments passed in? Perhaps we can inspect those and if there are any set them as priority over default location?
Author
Owner

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

Lemme just cross link a bunch of threads. I used to have a better mental map for this problem space. I thought there was one for "Set Terminal's CWD" but I can't find that now.

  • #15016
    • Filed recently and needs deduping
  • #5506
    • ye olde "Terminal's actual CWD should be system32 always and it should maintain a virtual CWD"
  • #14817
    • not super relevant, really only for admin/elevated
  • #9991
    • which points at...
  • #4637
    • This was the thread I was looking for!
  • #445
    • Has other relevant thoughts on the matter
@zadjii-msft commented on GitHub (Mar 28, 2023): Lemme just cross link a bunch of threads. I used to have a better mental map for this problem space. ~I thought there was one for "Set Terminal's CWD" but I can't find that now.~ * #15016 * Filed recently and needs deduping * #5506 * ye olde "Terminal's actual CWD should be `system32` always and it should maintain a virtual CWD" * #14817 * not super relevant, really only for admin/elevated * #9991 * which points at... * #4637 * This was the thread I was looking for! * #445 * Has other relevant thoughts on the matter
Author
Owner

@zadjii-msft commented on GitHub (May 2, 2023):

Okay, so there's comprehensive notes on the problem space over in https://github.com/microsoft/terminal/issues/4637#issuecomment-1531979200. There's also some vintage comments on why "I just want the starting directory of wt.exe to be sensible" in https://github.com/microsoft/terminal/pull/3547#issuecomment-553910121. There's just no way to tell if the initial directory of the Terminal is something the user actually wanted, or just a happenstance of the OS.

Ultimately, our recommendation for "I want to start the Terminal in the CWD of explorer using the address bar" is "type wt -d .". That'll explicitly let the Terminal do what you wanted. And if you set up shell integration, then the Terminal will be able to easily open subsequent tabs in that directory too.

@zadjii-msft commented on GitHub (May 2, 2023): Okay, so there's comprehensive notes on the problem space over in https://github.com/microsoft/terminal/issues/4637#issuecomment-1531979200. There's also some vintage comments on why "I just want the starting directory of `wt.exe` to be sensible" in https://github.com/microsoft/terminal/pull/3547#issuecomment-553910121. There's just no way to tell if the initial directory of the Terminal is something the user actually wanted, or just a happenstance of the OS. Ultimately, our recommendation for "I want to start the Terminal in the CWD of explorer using the address bar" is "type `wt -d .`". That'll explicitly let the Terminal do what you wanted. And if you set up [shell integration](https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory), then the Terminal will be able to easily open subsequent tabs in that directory too.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19585