Windows Terminal session restore is not remembering the last directory that was set in each tab #18887

Open
opened 2026-01-31 06:27:17 +00:00 by claunia · 0 comments
Owner

Originally created by @cyclr-adrian on GitHub (Nov 14, 2022).

Windows Terminal version

1.15.2875.0

Windows build number

10.0.22621.0

Other Software

I did have Oh-My-Posh module loading in via PowerShell profile, but I have since commented out that module from loading and running to eliminate it from this issue.

Steps to reproduce

Pre-Requisites

In your Windows Terminal Settings page set the following:

  1. Settings => Startup => When Terminal Starts set value to Open windows from previous session.
  2. The PowerShell profile you are using has a startingDirectory set e.g. "startingDirectory": "%USERPROFILE%"

Steps

  1. Load 2 PowerShell tabs in Windows Terminal
  2. Rename the tabs Tab 1 and Tab 2
  3. In Tab 2 change the directory so that it is different to the directory in Tab 1.
  4. Close Windows Terminal
  5. Re-Open Windows Terminal

Expected Behavior

When Re-Opening Windows Terminal Tab 1 and Tab 2 are restored with their tab names (Tab 1 and Tab 2) plus the initial directory in each tab is the same as it was when the previous Windows Terminal session was closed.

Actual Behavior

When Re-Opening Windows Terminal Tab 1 and Tab 2 are restored with their tab names (Tab 1 and Tab 2) however the initial directory in each tab is NOT the same as it was when the previous Windows Terminal session was closed, but tabs appear to have the same directory set.

I have tried changing the startingDirectory for the profile I was using from "startingDirectory": "%USERPROFILE%" to "startingDirectory": null but it makes no difference.

Originally created by @cyclr-adrian on GitHub (Nov 14, 2022). ### Windows Terminal version 1.15.2875.0 ### Windows build number 10.0.22621.0 ### Other Software I did have Oh-My-Posh module loading in via PowerShell profile, but I have since commented out that module from loading and running to eliminate it from this issue. ### Steps to reproduce #### Pre-Requisites In your Windows Terminal Settings page set the following: 1. `Settings` => `Startup` => `When Terminal Starts` set value to `Open windows from previous session`. 2. The PowerShell profile you are using has a `startingDirectory` set e.g. `"startingDirectory": "%USERPROFILE%"` #### Steps 1. Load 2 PowerShell tabs in Windows Terminal 3. Rename the tabs `Tab 1` and `Tab 2` 4. In `Tab 2` change the directory so that it is different to the directory in `Tab 1`. 5. Close Windows Terminal 6. Re-Open Windows Terminal ### Expected Behavior When Re-Opening Windows Terminal `Tab 1` and `Tab 2` are restored with their tab names (`Tab 1` and `Tab 2`) plus the initial directory in each tab is the same as it was when the previous Windows Terminal session was closed. ### Actual Behavior When Re-Opening Windows Terminal `Tab 1` and `Tab 2` are restored with their tab names (`Tab 1` and `Tab 2`) however the initial directory in each tab is NOT the same as it was when the previous Windows Terminal session was closed, but tabs appear to have the same directory set. I have tried changing the `startingDirectory` for the profile I was using from `"startingDirectory": "%USERPROFILE%"` to `"startingDirectory": null` but it makes no difference.
claunia added the Issue-QuestionNeeds-TriageIssue-BugResolution-Answered labels 2026-01-31 06:27:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18887