keep the same path after switching from powershell to command prompt #15903

Closed
opened 2026-01-31 04:51:46 +00:00 by claunia · 7 comments
Owner

Originally created by @ghost on GitHub (Nov 17, 2021).

Description of the new feature/enhancement

Proposed technical implementation details (optional)

When I open PowerShell by right-clicking in a folder, it opens in that path, but then when i switch to Command Prompt, it starts from User folder.

I want Windows Terminal to keep the same path after opening Command Prompt or other terminals from the tabs and not switch to their default path. so if i'm working with PowerShell in a specific directory and then open CMD from the same Terminal window, I want PowerShell to pass the current working directory to the CMD.

at least provide this as an option in Windows Terminal settings.

I'm using Windows 11 insider beta and the built-in Windows Terminal

Thanks

Originally created by @ghost on GitHub (Nov 17, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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 <!-- 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) <!-- A clear and concise description of what you want to happen. --> When I open PowerShell by right-clicking in a folder, it opens in that path, but then when i switch to Command Prompt, it starts from User folder. I want Windows Terminal to keep the same path after opening Command Prompt or other terminals from the tabs and not switch to their default path. so if i'm working with PowerShell in a specific directory and then open CMD from the same Terminal window, I want PowerShell to pass the current working directory to the CMD. at least provide this as an option in Windows Terminal settings. I'm using Windows 11 insider beta and the built-in Windows Terminal Thanks
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 04:51:46 +00:00
Author
Owner
@zadjii-msft commented on GitHub (Nov 17, 2021): Amassing notes here before the end of the day: * https://github.com/microsoft/terminal/issues/3158#issuecomment-764003033 * #10940 * #8933 * #9991 * #10614 * https://github.com/microsoft/terminal/issues/10105#issuecomment-842231981 I'll come through and turn that into an actual reply tomorrow morning
Author
Owner

@aungthanlwin commented on GitHub (Nov 17, 2021):

There is a workaround for this. You can use the -d option and "." (dot) notation to pass the current working directory to command prompt. For example, when you're in windows powershell, you can start command prompt with the command “wt -w 0 -p “Command Prompt” -d .” or "start cmd ."

@aungthanlwin commented on GitHub (Nov 17, 2021): There is a workaround for this. You can use the -d option and "." (dot) notation to pass the current working directory to command prompt. For example, when you're in windows powershell, you can start command prompt with the command “wt -w 0 -p “Command Prompt” -d .” or "start cmd ."
Author
Owner

@jthoward64 commented on GitHub (Nov 19, 2021):

There is a workaround for this. You can use the -d option and "." (dot) notation to pass the current working directory to command prompt. For example, when you're in windows powershell, you can start command prompt with the command “wt -w 0 -p “Command Prompt” -d .” or "start cmd ."

I think OP is referring to opening new profiles after running windows terminal from file explorer's context menu

@jthoward64 commented on GitHub (Nov 19, 2021): > There is a workaround for this. You can use the -d option and "." (dot) notation to pass the current working directory to command prompt. For example, when you're in windows powershell, you can start command prompt with the command “wt -w 0 -p “Command Prompt” -d .” or "start cmd ." I think OP is referring to opening new profiles after running windows terminal from file explorer's context menu
Author
Owner

@zadjii-msft commented on GitHub (Nov 23, 2021):

Okay, so lemme get this stright

  1. You right click in explorer (in c:\foo), and "open Windows Terminal here"
  2. You get a PowerShell tab in c:\foo
  3. You open a new Command Prompt tab, via the new tab menu or the command palette or whatever
  4. it opens in whatever cmd.exe's startingDirectory is set to

and you want step 4 to open in c:\foo. Originally, I thought we were tracking this in #8933, but that only applied when the startingDirectory is set to ..

Now, I think you're going to have to do the OSC9;9 thing to emit the working directory, and then wait for #10232 to allow opening a tab/pane with the same directory, but a different profile.

Do I have that right? If so, I'm gonna call this one a duplicate of #10232.

@zadjii-msft commented on GitHub (Nov 23, 2021): Okay, so lemme get this stright 1. You right click in explorer (in `c:\foo`), and "open Windows Terminal here" 2. You get a PowerShell tab in `c:\foo` 3. You open a new Command Prompt tab, via the new tab menu or the command palette or whatever 4. it opens in `whatever cmd.exe's startingDirectory is set to` and you want step 4 to open in `c:\foo`. Originally, I thought we were tracking this in #8933, but that only applied when the `startingDirectory` is set to `.`. Now, I think you're going to have to do the [OSC9;9 thing](https://github.com/MicrosoftDocs/terminal/pull/449/files) to emit the working directory, and then wait for #10232 to allow opening a tab/pane with the same directory, but a different profile. Do I have that right? If so, I'm gonna call this one a duplicate of #10232.
Author
Owner

@ghost commented on GitHub (Nov 24, 2021):

Okay, so lemme get this stright

  1. You right click in explorer (in c:\foo), and "open Windows Terminal here"
  2. You get a PowerShell tab in c:\foo
  3. You open a new Command Prompt tab, via the new tab menu or the command palette or whatever
  4. it opens in whatever cmd.exe's startingDirectory is set to

and you want step 4 to open in c:\foo. Originally, I thought we were tracking this in #8933, but that only applied when the startingDirectory is set to ..

Now, I think you're going to have to do the OSC9;9 thing to emit the working directory, and then wait for #10232 to allow opening a tab/pane with the same directory, but a different profile.

Do I have that right? If so, I'm gonna call this one a duplicate of #10232.

Yes you got it right, I want it exactly like that.
thank you

@ghost commented on GitHub (Nov 24, 2021): > Okay, so lemme get this stright > > 1. You right click in explorer (in `c:\foo`), and "open Windows Terminal here" > 2. You get a PowerShell tab in `c:\foo` > 3. You open a new Command Prompt tab, via the new tab menu or the command palette or whatever > 4. it opens in `whatever cmd.exe's startingDirectory is set to` > > and you want step 4 to open in `c:\foo`. Originally, I thought we were tracking this in #8933, but that only applied when the `startingDirectory` is set to `.`. > > Now, I think you're going to have to do the [OSC9;9 thing](https://github.com/MicrosoftDocs/terminal/pull/449/files) to emit the working directory, and then wait for #10232 to allow opening a tab/pane with the same directory, but a different profile. > > Do I have that right? If so, I'm gonna call this one a duplicate of #10232. Yes you got it right, I want it exactly like that. thank you
Author
Owner

@zadjii-msft commented on GitHub (Nov 24, 2021):

Awesome, thanks!

/dup #10232

@zadjii-msft commented on GitHub (Nov 24, 2021): Awesome, thanks! /dup #10232
Author
Owner

@ghost commented on GitHub (Nov 24, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Nov 24, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15903