Clarity on Running Commands #14891

Closed
opened 2026-01-31 04:22:30 +00:00 by claunia · 2 comments
Owner

Originally created by @hl2guide on GitHub (Aug 17, 2021).

Windows Terminal version (or Windows build number)

Windows Terminal 1.9.1942.0

Other Software

No response

Steps to reproduce

  • Have a .ps1 file at a location
  • open up the command line (cmd.exe)
  • run: wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -c "create_combined_list.ps1"

%GHGEN% = Environment Variable of location

Expected Behavior

PowerShell script runs.

Please try to improve the documentation about this.

Actual Behavior

this error is shown:
[error 0x80070002 when launching 'create_combined_list.ps1']

this works to go to a directory:

wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN%

but these don't run a PS1 file:

wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -c "create_combined_list.ps1"

wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -c ".\create_combined_list.ps1"
Originally created by @hl2guide on GitHub (Aug 17, 2021). ### Windows Terminal version (or Windows build number) Windows Terminal 1.9.1942.0 ### Other Software _No response_ ### Steps to reproduce - Have a .ps1 file at a location - open up the command line (cmd.exe) - run: `wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -c "create_combined_list.ps1"` %GHGEN% = Environment Variable of location ### Expected Behavior PowerShell script runs. Please try to improve the documentation about this. ### Actual Behavior this error is shown: `[error 0x80070002 when launching 'create_combined_list.ps1']` this works to go to a directory: `wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN%` but these don't run a PS1 file: ``` wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -c "create_combined_list.ps1" wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -c ".\create_combined_list.ps1" ```
claunia added the Issue-QuestionNeeds-TriageNeeds-Tag-FixResolution-Answered labels 2026-01-31 04:22:30 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 18, 2021):

The commandline parameter of the new-tab command isn't appended to the profile's commandline, it replaces it. So the Terminal is trying to literally CreateProcess("create_combined_list.ps1", ...); , which isn't a valid commandline. You probably want powershell create_combined_list.ps1 (or whatever the commandline for running a ps1 in powershell is).

wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -- powershell create_combined_list.ps1

Should work just fine

@zadjii-msft commented on GitHub (Aug 18, 2021): The `commandline `parameter of the `new-tab` command isn't _appended_ to the profile's `commandline`, it _replaces_ it. So the Terminal is trying to literally `CreateProcess("create_combined_list.ps1", ...); `, which isn't a valid commandline. You probably want `powershell create_combined_list.ps1` (or whatever the commandline for running a `ps1` in powershell is). ``` wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -- powershell create_combined_list.ps1 ``` Should work just fine
Author
Owner

@hl2guide commented on GitHub (Aug 19, 2021):

The commandline parameter of the new-tab command isn't appended to the profile's commandline, it replaces it. So the Terminal is trying to literally CreateProcess("create_combined_list.ps1", ...); , which isn't a valid commandline. You probably want powershell create_combined_list.ps1 (or whatever the commandline for running a ps1 in powershell is).

wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -- powershell create_combined_list.ps1

Should work just fine

nope, maybe the syntax needs a look over to make it less clunky, limited and rigid.

@hl2guide commented on GitHub (Aug 19, 2021): > The `commandline `parameter of the `new-tab` command isn't _appended_ to the profile's `commandline`, it _replaces_ it. So the Terminal is trying to literally `CreateProcess("create_combined_list.ps1", ...); `, which isn't a valid commandline. You probably want `powershell create_combined_list.ps1` (or whatever the commandline for running a `ps1` in powershell is). > > ``` > wt.exe new-tab --profile "PowerShell" --title "Generating the AIO List" -d %GHGEN% -- powershell create_combined_list.ps1 > ``` > > Should work just fine nope, maybe the syntax needs a look over to make it less clunky, limited and rigid.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14891