Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to send command line to the console of a profile #16062

Closed
htcfreek opened this issue Sep 29, 2023 · 5 comments
Closed

[Question] How to send command line to the console of a profile #16062

htcfreek opened this issue Sep 29, 2023 · 5 comments
Labels
Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Answered Related to questions that have been answered

Comments

@htcfreek
Copy link

htcfreek commented Sep 29, 2023

Description of the new feature/enhancement

How can I start WT with a specified profile and send arguments to the console of this profile (e.g. use Powershell profile and ping host).

I tired wt.exe new-tab -p "Powershell" -c "Get-Services" which results in an error message:

[Fehler 2147942402 (0x80070002) beim Start von `{Get-Services}']

xref: https://learn.microsoft.com/de-de/windows/terminal/command-line-arguments?tabs=windows#passing-an-argument-to-the-default-shell

Proposed technical implementation details (optional)

@htcfreek htcfreek added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Sep 29, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Sep 29, 2023
@htcfreek
Copy link
Author

@zadjii-msft
Is the problem I described a bug or simply not implemented?

@zadjii-msft
Copy link
Member

Oh, I think you're just doing it wrong here. I suspect what you're trying to do is the --appendCommandline thing, from #5528 / #15822.

When you call wt -p "PowerShell" -c Get-Services, wt treats -c Get-Services as the command parameter, and replaces your PowerShell profile's commandline with that. And CreateProcess("-c Get-Services",...) clearly doesn't work 😝

So, you'll either want

  • wt -p PowerShell -- {path to powershell} -c Get-Services
  • wt -p PowerShell --appendCommandline -- -c Get-Services (starting in v1.19)

@zadjii-msft zadjii-msft added Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Sep 29, 2023
@htcfreek
Copy link
Author

So, you'll either want wt -p PowerShell -- {path to powershell} -c Get-Services

@zadjii-msft
Does {path to powershell} respect the path variable? Or do I need to specify the full path?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Sep 29, 2023
@zadjii-msft
Copy link
Member

Typically, yes, it'll respect the PATH. If you're just doing simple scripting, that's usually fine, though, BEST PRACTICE would be to specify the full path.

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Sep 29, 2023
@htcfreek
Copy link
Author

htcfreek commented Oct 2, 2023

@zadjii-msft
Thank you for your help. I think this is what I need.
Unfortunately I can't test the v1.19 command line because wt.exe entered in run dialog brings me an access denied error.

@htcfreek htcfreek closed this as completed Oct 2, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

2 participants