Add option to change the starting directory to %UserProfile% or make it configurable for the WT process. #9460

Closed
opened 2026-01-31 01:55:03 +00:00 by claunia · 2 comments
Owner

Originally created by @trajano on GitHub (Jul 6, 2020).

Description of the new feature/enhancement

When wt.exe executes from the Start menu it is actually started from C:\Windows\system32. Any new tabs or processes by default start from the first process. This proposal is to provide a way of overriding the default behavior specific to when it gets started from the Start Menu (if it can be detected as such) or do something along the lines of

if I am started from "C:\windows\system32" `change my current process directory to "%UserProfile%".

Proposed technical implementation details (optional)

Full configurability

{
   "processOverrides" : [
     {
       "changeDirectoryIfStartedFrom":  {
         "from": "C:\Windows\System32",
         "to": "%UserProfile%"
       }
     }
   ]
}

More system agnostic which does the same as above but will determine where the system folder is since it can be not C:\.

{
   "processOverrides" : [
     {
       "changeDirectoryIfStartedFrom":  "systemFolderToUserProfile"
     }
   ]
}

If you can detect if it is launched from start menu

{
   "changeDirectoryToProfileIfLaunchedFromStart": true
}
Originally created by @trajano on GitHub (Jul 6, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement When wt.exe executes from the Start menu it is actually started from `C:\Windows\system32`. Any new tabs or processes by default start from the first process. This proposal is to provide a way of overriding the default behavior specific to when it gets started from the Start Menu (if it can be detected as such) or do something along the lines of if I am started from "C:\windows\system32" `change my current process directory to "%UserProfile%". <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) Full configurability ``` { "processOverrides" : [ { "changeDirectoryIfStartedFrom": { "from": "C:\Windows\System32", "to": "%UserProfile%" } } ] } ``` More system agnostic which does the same as above but will determine where the system folder is since it can be not `C:\`. ``` { "processOverrides" : [ { "changeDirectoryIfStartedFrom": "systemFolderToUserProfile" } ] } ``` If you can detect if it is launched from start menu ``` { "changeDirectoryToProfileIfLaunchedFromStart": true } ```
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 01:55:03 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 6, 2020):

This is one of the most annoying things we've run into with our app platform. Our answer was add support for startingDirectory and set it to USERPROFILE by default.

If we could easily and safely detect that we had been started from the start menu, we 100% would... but it's just not readily possible today. There's so much more information in https://github.com/microsoft/terminal/pull/3547#issue-340153021. We never got clarity on the unexpected/desirable cases here and felt like the division of launch types introduced even more uncertainty.

I'm going to close this one out as "tried, realized it would make things worse for users, and we're not a fan of the procedural override proposal." If we put that together into a spec, and got it reviewed, I'd of course consider it 😄

@DHowett commented on GitHub (Jul 6, 2020): This is one of the most annoying things we've run into with our app platform. Our answer was _add support for `startingDirectory` and set it to `USERPROFILE` by default._ If we could easily and safely detect that we had been started from the start menu, we 100% would... but it's just not readily possible today. There's so much more information in https://github.com/microsoft/terminal/pull/3547#issue-340153021. We never got clarity on the unexpected/desirable cases here and felt like the division of launch types introduced even more uncertainty. I'm going to close this one out as "tried, realized it would make things worse for users, and we're not a fan of the procedural override proposal." If we put that together into a spec, and got it reviewed, I'd of course consider it :smile:
Author
Owner

@trajano commented on GitHub (Jul 6, 2020):

@DHowett I don't think your answer of

startingDirectory and set it to USERPROFILE by default.
is a good one either.

As far as things go, I want the default to be what it normally is, but allow some changes. Perhaps instead of making it "explicit" we can explore the notion of some user scripts that can be executed before the wt executes the command, except at present JSON is a terrible place to put it in nicely.

Is there a spec right now to provide some sort of scripting capability (rather than a full plugin system) so we can alter the behaviour of wt without something overtly complicated that requires a full compiler.

@trajano commented on GitHub (Jul 6, 2020): @DHowett I don't think your answer of > startingDirectory and set it to USERPROFILE by default. is a good one either. As far as things go, I want the default to be what it normally is, but allow some changes. Perhaps instead of making it "explicit" we can explore the notion of some user scripts that can be executed before the wt executes the command, except at present JSON is a terrible place to put it in nicely. Is there a spec right now to provide some sort of scripting capability (rather than a full plugin system) so we can alter the behaviour of wt without something overtly complicated that requires a full compiler.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9460