Open windows from a previous session does not restore the working directories of any tab #20486

Closed
opened 2026-01-31 07:15:10 +00:00 by claunia · 2 comments
Owner

Originally created by @abatishchev on GitHub (Sep 16, 2023).

Windows Terminal version

1.17.11461.0

Windows build number

10.0.19045.0

Other Software

PowerShell Core:

$PSVersionTable.PSVersion.ToString()
7.3.6

PS> Get-Module | select Name,Version

Name                         Version
----                         -------
Microsoft.PowerShell.Utility 7.0.0.0
PSReadLine                   2.2.6

PowerShell For Windows:

PS> $PSVersionTable.PSVersion.ToString()
5.1.19041.3031

PS> Get-Module | select Name,Version

Name                                      Version
----                                      -------
Microsoft.Azure.Deployment.Express.Client 1.0.0.0
Microsoft.PowerShell.Management           3.1.0.0
Microsoft.PowerShell.Security             3.0.0.0
Microsoft.PowerShell.Utility              3.1.0.0
Microsoft.WSMan.Management                3.0.0.0
PSReadline                                2.0.0

Steps to reproduce

  1. Configure Windows Terminal to "open windows from a previous session"
  2. Open various tabs, switch to different working directories
  3. Close Windows Terminal

Expected Behavior

Windows Terminal to restore the previous session with all tabs having opened their last working directory.

Actual Behavior

Windows Terminal restores the tabs and panes as expected, but does not switch into the correct directories, instead remains in the default configured ($env:USERPROFILE)

Originally created by @abatishchev on GitHub (Sep 16, 2023). ### Windows Terminal version 1.17.11461.0 ### Windows build number 10.0.19045.0 ### Other Software PowerShell Core: ```powershell $PSVersionTable.PSVersion.ToString() 7.3.6 PS> Get-Module | select Name,Version Name Version ---- ------- Microsoft.PowerShell.Utility 7.0.0.0 PSReadLine 2.2.6 ``` PowerShell For Windows: ```powershell PS> $PSVersionTable.PSVersion.ToString() 5.1.19041.3031 PS> Get-Module | select Name,Version Name Version ---- ------- Microsoft.Azure.Deployment.Express.Client 1.0.0.0 Microsoft.PowerShell.Management 3.1.0.0 Microsoft.PowerShell.Security 3.0.0.0 Microsoft.PowerShell.Utility 3.1.0.0 Microsoft.WSMan.Management 3.0.0.0 PSReadline 2.0.0 ``` ### Steps to reproduce 1. Configure Windows Terminal to "open windows from a previous session" 2. Open various tabs, switch to different working directories 3. Close Windows Terminal ### Expected Behavior Windows Terminal to restore the previous session with all tabs having opened their last working directory. ### Actual Behavior Windows Terminal restores the tabs and panes as expected, but does not switch into the correct directories, instead remains in the default configured (`$env:USERPROFILE`)
Author
Owner

@abatishchev commented on GitHub (Sep 16, 2023):

This issue is exactly like #14270 but I don't have Oh My Posh (or any other additional software I could think could cause this) installed.

@abatishchev commented on GitHub (Sep 16, 2023): This issue is exactly like #14270 but I don't have Oh My Posh (or any other additional software I could think could cause this) installed.
Author
Owner

@zadjii-msft commented on GitHub (Sep 18, 2023):

As mentioned in #14270:

Did you configure your shell to tell the Terminal what the CWD is/?

Refer to: Opening a tab or pane in the same directory in Windows Terminal.

See also microsoft/terminal/issues (restore directory)

You need to configure the shell to tell the Terminal about the CWD, for terminal to be able to restore them.

@zadjii-msft commented on GitHub (Sep 18, 2023): As mentioned in #14270: > Did you configure your shell to tell the Terminal what the CWD is/? > > Refer to: [Opening a tab or pane in the same directory in Windows Terminal](https://docs.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory). > > See also [microsoft/terminal/issues (restore directory)](https://github.com/microsoft/terminal/issues?q=is%3Aissue++restore+directory+) You need to configure the shell to tell the Terminal about the CWD, for terminal to be able to restore them.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20486