Skip to content

Conversation

Copy link

Copilot AI commented Dec 18, 2025

When firstWindowPreference: "persistedWindowLayout" is enabled, running wt nt -p <profile> opens two windows: one restoring the previous session and one executing the command. This behavior was undocumented.

Changes

  • Added IMPORTANT callout in command-line syntax section explaining the dual-window behavior and referencing --window option for control
  • Added new section "Session restore and command line arguments" with three workarounds:
    • wt -w 0 nt -p <profile> - Opens in most recently used window (avoids second window)
    • wt -w -1 nt -p <profile> - Forces new window without session restore
    • wt -w <name> nt -p <profile> - Opens in named window
  • Included shell-specific examples for Command Prompt, PowerShell, and Linux/WSL

Example

// Without -w flag: opens TWO windows (restored session + new command)
wt nt -p "Ubuntu-18.04"

// With -w 0: opens ONE window (new tab in existing window)
wt -w 0 nt -p "Ubuntu-18.04"
Original prompt

This section details on the original issue you should resolve

<issue_title>Feedback: wt nt -p opens two windows</issue_title>
<issue_description>### Type of issue

Other (describe below)

Feedback

Currently, if "Startup / When Terminal starts = Open windows from a previous session" option is set, then a command like wt nt -p <profile> will open two windows. The documentation should add instructions to disable this feature when starting Windows Terminal from the command line, or add a switch to disable session restore.

Page URL

https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows

Content source URL

https://github.com/MicrosoftDocs/terminal/blob/main/TerminalDocs/command-line-arguments.md

Author

@nguyen-dows

Document Id

0d5d0fe3-01ef-66e8-263d-a0a7852ffa7a</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@learn-build-service-prod
Copy link

Learn Build status updates of commit 10c15a7:

✅ Validation status: passed

For more details, please refer to the build report.

…ments

Co-authored-by: mattwojo <7566797+mattwojo@users.noreply.github.com>
@learn-build-service-prod
Copy link

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link

Learn Build status updates of commit 397b755:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/command-line-arguments.md ✅Succeeded View

For more details, please refer to the build report.

Co-authored-by: mattwojo <7566797+mattwojo@users.noreply.github.com>
@learn-build-service-prod
Copy link

Learn Build status updates of commit e1ee1d2:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/command-line-arguments.md ✅Succeeded View

For more details, please refer to the build report.

@learn-build-service-prod
Copy link

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Co-authored-by: mattwojo <7566797+mattwojo@users.noreply.github.com>
@learn-build-service-prod
Copy link

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link

Learn Build status updates of commit fb863f0:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/command-line-arguments.md ✅Succeeded View

For more details, please refer to the build report.

…tyle

Co-authored-by: mattwojo <7566797+mattwojo@users.noreply.github.com>
@learn-build-service-prod
Copy link

Learn Build status updates of commit 84e538c:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/command-line-arguments.md ✅Succeeded View

For more details, please refer to the build report.

@learn-build-service-prod
Copy link

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Copilot AI changed the title [WIP] Update documentation to address multiple window issue Document session restore interaction with command-line arguments Dec 18, 2025
Copilot AI requested a review from mattwojo December 18, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feedback: wt nt -p <profile> opens two windows

2 participants