[PR #3547] [CLOSED] Enable wt to inherit the working directory #25419

Open
opened 2026-01-31 09:09:24 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3547
Author: @zadjii-msft
Created: 11/12/2019
Status: Closed

Base: masterHead: dev/migrie/f/878-proto


📝 Commits (9)

  • 2987364 This is a prototype for #878
  • c4c0d73 Merge remote-tracking branch 'origin/master' into dev/migrie/f/878-proto
  • 62f99a2 Merge branch 'master' into dev/migrie/f/878-proto
  • 80203ed I guess I can't have a nullptr hstring. I'll figure something else out.
  • aa183fd well this might work...
  • 3cc07ae This is almost right, but not for win->'wtd'. That case still launches system32
  • bfc2370 we thought this would work, but it really didn't. The module path is the real path, but the commandline was the alias path
  • 4478584 Add comments
  • 3e41699 clearing makes much more sense

📊 Changes

9 files changed (+78 additions, -3 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppLogic.cpp (+16 -0)
📝 src/cascadia/TerminalApp/AppLogic.h (+2 -0)
📝 src/cascadia/TerminalApp/AppLogic.idl (+3 -2)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+25 -0)
📝 src/cascadia/TerminalApp/TerminalPage.h (+4 -0)
📝 src/cascadia/WindowsTerminal/AppHost.cpp (+19 -0)
📝 src/cascadia/WindowsTerminal/AppHost.h (+2 -0)
📝 src/cascadia/WindowsTerminal/main.cpp (+3 -1)
📝 src/cascadia/WindowsTerminal/pch.h (+4 -0)

📄 Description

Summary of the Pull Request

Enable wt to inherit the working directory from the commandline and Explorer.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

I don't feel totally confident in this change. This changes two scenarios, and the run dialog one I'm not super happy about:

  1. Explorer address bar: wtd -> Results in the Terminal being launched in the current path of explorer.
  2. From a commandline shell: wtd -> Results in the Terminal being launched in the current path of shell.
  3. Windows Search: Win, Term (or anything to get to "Windows Terminal)" -> Results in the Terminal being launched in startingDirectory
  4. Run Dialog: Win+R, wtd -> Results in the Terminal being launched in %USERPROFILE%
  • this is the CWD of the run dialog
  • maybe unexpected?
  1. Windows Search: Win, wtd -> Results in the Terminal being launched in C:\Windows\System32
  • technically, the Start menu is invoking the wtd commandline here.
  • maybe unexpected?

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/3547 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 11/12/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `dev/migrie/f/878-proto` --- ### 📝 Commits (9) - [`2987364`](https://github.com/microsoft/terminal/commit/29873649d4d9e8a5f37ee044989ef53fcc9d7a30) This is a prototype for #878 - [`c4c0d73`](https://github.com/microsoft/terminal/commit/c4c0d73fb983c9cdef5dc180680693d53feb665b) Merge remote-tracking branch 'origin/master' into dev/migrie/f/878-proto - [`62f99a2`](https://github.com/microsoft/terminal/commit/62f99a2ed3c77faca7149a19e47f3c0678ce019c) Merge branch 'master' into dev/migrie/f/878-proto - [`80203ed`](https://github.com/microsoft/terminal/commit/80203eddf86ad15ccf15353e8aab4cd98f6732e4) I guess I can't have a nullptr hstring. I'll figure something else out. - [`aa183fd`](https://github.com/microsoft/terminal/commit/aa183fd29bdd49bc95a152a0abd29f11b2db028c) well this might work... - [`3cc07ae`](https://github.com/microsoft/terminal/commit/3cc07aedd1644d9caf469722c307f6973047b99e) This is _almost_ right, but not for win->'wtd<enter>'. That case still launches system32 - [`bfc2370`](https://github.com/microsoft/terminal/commit/bfc237076789d9fb5e5d076c86b5fd39966cd8fc) we thought this would work, but it _really_ didn't. The module path is the real path, but the commandline was the _alias_ path - [`4478584`](https://github.com/microsoft/terminal/commit/447858401751534150957fe4df073c47cfa77484) Add comments - [`3e41699`](https://github.com/microsoft/terminal/commit/3e4169950c3e0cada2bcb4d1d965226c99a6ca9a) clearing makes much more sense ### 📊 Changes **9 files changed** (+78 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+16 -0) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+2 -0) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+3 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+25 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+4 -0) 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+19 -0) 📝 `src/cascadia/WindowsTerminal/AppHost.h` (+2 -0) 📝 `src/cascadia/WindowsTerminal/main.cpp` (+3 -1) 📝 `src/cascadia/WindowsTerminal/pch.h` (+4 -0) </details> ### 📄 Description ## Summary of the Pull Request Enable `wt` to inherit the working directory from the commandline and Explorer. ## References ## PR Checklist * [x] Closes #878 * [x] I work here * [n/a?] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments I don't feel totally confident in this change. This changes two scenarios, and the run dialog one I'm not super happy about: 1. Explorer address bar: `wtd` -> Results in the Terminal being launched in the current path of explorer. 2. From a commandline shell: `wtd` -> Results in the Terminal being launched in the current path of shell. 3. Windows Search: <kbd>Win</kbd>, `Term` (or anything to get to "Windows Terminal)" -> Results in the Terminal being launched in `startingDirectory` 4. Run Dialog: <kbd>Win+R</kbd>, `wtd` -> Results in the Terminal being launched in %USERPROFILE% - this is the CWD of the run dialog - **maybe unexpected?** 5. Windows Search: <kbd>Win</kbd>, `wtd` -> Results in the Terminal being launched in `C:\Windows\System32` - _technically_, the Start menu is invoking the `wtd` commandline here. - **maybe unexpected?** --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:09:24 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25419