Document session restore interaction with command-line arguments#913
Conversation
|
Learn Build status updates of commit 10c15a7: ✅ Validation status: passedFor more details, please refer to the build report. |
…ments Co-authored-by: mattwojo <[email protected]>
PoliCheck Scan ReportThe 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 foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 397b755: ✅ Validation status: passed
For more details, please refer to the build report. |
Co-authored-by: mattwojo <[email protected]>
|
Learn Build status updates of commit e1ee1d2: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe 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 foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
Co-authored-by: mattwojo <[email protected]>
PoliCheck Scan ReportThe 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 foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit fb863f0: ✅ Validation status: passed
For more details, please refer to the build report. |
…tyle Co-authored-by: mattwojo <[email protected]>
|
Learn Build status updates of commit 84e538c: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe 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 foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
|
||
| > [!IMPORTANT] | ||
| > If you have enabled the **"Open windows from a previous session"** startup option ([`firstWindowPreference: "persistedWindowLayout"`](./customize-settings/startup.md#behavior-when-starting-a-new-terminal-session)), running `wt` from the command line will restore your previous session **and** execute the command you provided, potentially opening two windows. To prevent this behavior, use the `--window, -w` option to control where your command executes: | ||
| > - `wt -w 0 nt -p <profile>` - Opens in the most recently used window (prevents a second window from opening) |
There was a problem hiding this comment.
(starting from "To prevent this behavior, use the --window, -w option to control where your command executes:")
Nope. This doesn't work this way. Don't add any commentary on how to prevent that behavior - when firstWindowPreference is set to restore things, then any cold wt nt command will both restore and run the new command.
| To avoid this behavior when session restore is enabled, use the `--window, -w` option to control where your commands execute: | ||
|
|
||
| <!-- Start tab selectors. --> | ||
| #### [Command Prompt](#tab/windows) | ||
|
|
||
| ```cmd | ||
| // Open a new tab with a specific profile in the most recently used window (avoids opening a second window) | ||
| wt -w 0 nt -p "Ubuntu-18.04" | ||
|
|
||
| // Force a new window with the profile, without restoring previous session | ||
| wt -w -1 nt -p "Command Prompt" | ||
|
|
||
| // Open in a named window (creates it only if it doesn't exist) | ||
| wt -w mywork nt -p "PowerShell" | ||
| ``` | ||
|
|
||
| #### [PowerShell](#tab/powershell) | ||
|
|
||
| ```powershell | ||
| // Open a new tab with a specific profile in the most recently used window (avoids opening a second window) | ||
| wt -w 0 nt -p "Ubuntu-18.04" | ||
|
|
||
| // Force a new window with the profile, without restoring previous session | ||
| wt -w -1 nt -p "Command Prompt" | ||
|
|
||
| // Open in a named window (creates it only if it doesn't exist) | ||
| wt -w mywork nt -p "PowerShell" | ||
| ``` | ||
|
|
||
| #### [Linux](#tab/linux) | ||
|
|
||
| ```bash | ||
| // Open a new tab with a specific profile in the most recently used window (avoids opening a second window) | ||
| cmd.exe /c "wt.exe" -w 0 nt -p "Ubuntu-18.04" | ||
|
|
||
| // Force a new window with the profile, without restoring previous session | ||
| cmd.exe /c "wt.exe" -w -1 nt -p "Command Prompt" | ||
|
|
||
| // Open in a named window (creates it only if it doesn't exist) | ||
| cmd.exe /c "wt.exe" -w mywork nt -p "PowerShell" | ||
| ``` | ||
|
|
||
| Execution aliases don't work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running `cmd.exe`. The `/c` option tells CMD to terminate after running. | ||
|
|
||
| --- | ||
| <!-- End tab selectors. --> |
There was a problem hiding this comment.
similarly, drop this all.
When
firstWindowPreference: "persistedWindowLayout"is enabled, runningwt nt -p <profile>opens two windows: one restoring the previous session and one executing the command. This behavior was undocumented.Changes
--windowoption for controlwt -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 restorewt -w <name> nt -p <profile>- Opens in named windowExample
Original prompt
💡 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.