Display a warning when someone passes an invalid profile name on the wt commandline #8413

Open
opened 2026-01-31 01:28:54 +00:00 by claunia · 5 comments
Owner

Originally created by @thlac on GitHub (May 21, 2020).

Environment

Windows build number: 10.0.19041.264
Windows Terminal version (if applicable): 1.0.1401.0

Profiles:
Windows Powershell
Command Prompt
PowerShell
PowerShell 7 Preview
Ubuntu
Azure Cloud Shell

Config: settings.txt

Steps to reproduce

  1. wt -p Windows PowerShell
    Causes Windows Powershell to be loaded, but with Powershell (Core) as the profile
  2. wt -p Command Prompt
    Following message is shown: [error 0x80070002 when launching `Prompt'] (Is using the Powershell (Core) profile but the tab name is empty)
  3. wt -p ubuntu
    Launches Powershell (Core)

Expected behavior

Less confusing behaviour, from what I have observed it seems like, on my system at least, the Powershell (Core) profile is considered a default of sorts, so if it doesn't find a direct match it just opens that. It also seems that the second argument seems to be passed as an argument to the profile, not entirely sure if that's right way to describe it, as wt -p Windows Get-Date results in the same error as the Command Prompt example instead of executing Get-Date.

So I think ways of adressing that would be:

  1. Commands should only accept the ones defined in the documentation, (e.g. new-tab, split-pane, focus-tab)
  2. If a direct (case insensitive) profile match isn't found, is it possible to launch the default profile while displaying to the user that the selected profile wasn't found?
  3. (imo) If a direct (case insensitive) profile match is found do launch that, instead of the default. (i.e. wt -p ubuntu is the same as wt -p Ubuntu)

Actual behavior

In steps to reproduce, above.

Originally created by @thlac on GitHub (May 21, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.19041.264 Windows Terminal version (if applicable): 1.0.1401.0 Profiles: Windows Powershell Command Prompt PowerShell PowerShell 7 Preview Ubuntu Azure Cloud Shell ``` Config: [settings.txt](https://github.com/microsoft/terminal/files/4662704/settings.txt) # Steps to reproduce 1. `wt -p Windows PowerShell` Causes Windows Powershell to be loaded, but with Powershell (Core) as the profile 2. `wt -p Command Prompt` Following message is shown: [error 0x80070002 when launching `Prompt'] (Is using the Powershell (Core) profile but the tab name is empty) 3. `wt -p ubuntu` Launches Powershell (Core) # Expected behavior Less confusing behaviour, from what I have observed it seems like, on my system at least, the Powershell (Core) profile is considered a default of sorts, so if it doesn't find a direct match it just opens that. It also seems that the second argument seems to be passed as an argument to the profile, not entirely sure if that's right way to describe it, as `wt -p Windows Get-Date` results in the same error as the Command Prompt example instead of executing Get-Date. So I think ways of adressing that would be: 1. Commands should only accept the ones defined in the documentation, (e.g. `new-tab`, `split-pane`, `focus-tab`) 2. If a direct (case insensitive) profile match isn't found, is it possible to launch the default profile while displaying to the user that the selected profile wasn't found? 3. (imo) If a direct (case insensitive) profile match is found do launch that, instead of the default. (i.e. `wt -p ubuntu` is the same as `wt -p Ubuntu`) # Actual behavior In steps to reproduce, above.
claunia added the Issue-TaskProduct-TerminalArea-Commandline labels 2026-01-31 01:28:54 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 27, 2020):

You need to use spaces to wrap the profile names as a single argument - so do wt -p "Windows Powershell" or wt -p "Command Prompt". For more details, refer to command-line arg documentation

@zadjii-msft commented on GitHub (May 27, 2020): You need to use spaces to wrap the profile names as a single argument - so do `wt -p "Windows Powershell"` or `wt -p "Command Prompt"`. For more details, refer to [command-line arg documentation](https://docs.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows)
Author
Owner

@thlac commented on GitHub (May 27, 2020):

Hi, I'm sorry if I didn't phrase the issue better, but none of the issues I mentioned are related to quotes itself, they are how I discovered the issues, but everything I wrote is still the case, whether quotes are used or not.

@thlac commented on GitHub (May 27, 2020): Hi, I'm sorry if I didn't phrase the issue better, but none of the issues I mentioned are related to quotes itself, they are how I discovered the issues, but everything I wrote is still the case, whether quotes are used or not.
Author
Owner

@zadjii-msft commented on GitHub (May 27, 2020):

Ah okay, gotcha. Sorry, long day triaging.

If we can't find the profile provided, you're right, we default to whatever the default profile is for your settings. So that's why it seems like "powershell core" is the default value - it probably is.

RE:

  • Commands should only accept the ones defined in the documentation, (e.g. new-tab, split-pane, focus-tab)

  • If a direct (case insensitive) profile match isn't found, is it possible to launch the default profile while displaying to the user that the selected profile wasn't found?

  • (imo) If a direct (case insensitive) profile match is found do launch that, instead of the default. (i.e. wt -p ubuntu is the same as wt -p Ubuntu)

  1. I'm not sure I totally get what the problem is here - we definitely only accept the given subcommands. Everything that we don't recognize that's passed to new-tab or split-pane is treated as a commandline value to use instead of the commandline from the profile. When there's no subcommand provided, we default to new-tab.
  2. This isn't a terrible idea.
  3. I tried playing with case-insensitivity in #5690, though, I think we're probably going to stick with case sensitivity at this point.
@zadjii-msft commented on GitHub (May 27, 2020): Ah okay, gotcha. Sorry, long day triaging. If we can't find the profile provided, you're right, we default to whatever the default profile is for your settings. So that's why it seems like "powershell core" is the default value - it probably is. RE: > * Commands should only accept the ones defined in the documentation, (e.g. `new-tab`, `split-pane`, `focus-tab`) > > * If a direct (case insensitive) profile match isn't found, is it possible to launch the default profile while displaying to the user that the selected profile wasn't found? > > * (imo) If a direct (case insensitive) profile match is found do launch that, instead of the default. (i.e. `wt -p ubuntu` is the same as `wt -p Ubuntu`) 1. I'm not sure I totally get what the problem is here - we definitely only accept the given subcommands. Everything that we don't recognize that's passed to `new-tab` or `split-pane` is treated as a `commandline` value to use instead of the `commandline` from the profile. When there's no subcommand provided, we default to `new-tab`. 2. **This isn't a terrible idea.** 3. I tried playing with case-insensitivity in #5690, though, I think we're probably going to stick with case sensitivity at this point.
Author
Owner

@thlac commented on GitHub (May 27, 2020):

No worries, I can imagine you're all pretty swamped with a sudden influx of reports from releasing at build. 😄

In regards to 1., your explanation helped me see that I misunderstood the documentation, wt -p "Powershell" is, as you point out, the equivalent of wt new-tab -p "Powershell". So what I thought was a command was actually a parameter for the command. So in the end it's getting passed to the commandline parameter of the new-tab command, exactly as the documentation states. Sorry for missing that.

I didn't see you were already experimenting with case sensitivity, so that's fair.

@thlac commented on GitHub (May 27, 2020): No worries, I can imagine you're all pretty swamped with a sudden influx of reports from releasing at build. 😄 In regards to 1., your explanation helped me see that I misunderstood the documentation, `wt -p "Powershell"` is, as you point out, the equivalent of `wt new-tab -p "Powershell"`. So what I thought was a command was actually a parameter for the command. So in the end it's getting passed to the `commandline` parameter of the `new-tab` command, exactly as the documentation states. Sorry for missing that. I didn't see you were already experimenting with case sensitivity, so that's fair.
Author
Owner

@htcfreek commented on GitHub (Sep 29, 2023):

Two thoughts on this:

  • The profile name is case sensitive. (Example: "Poershell 7" != PowerShell 7`)
  • I agree that a notification about the wrong profile name makes sense.
@htcfreek commented on GitHub (Sep 29, 2023): Two thoughts on this: - The profile name is case sensitive. (Example: `"Poershell 7" != `PowerShell 7`) - I agree that a notification about the wrong profile name makes sense.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8413