Unable to pass command line parameters after the double dash in Windows Terminal #22581

Closed
opened 2026-01-31 08:17:35 +00:00 by claunia · 3 comments
Owner

Originally created by @hh54188 on GitHub (Nov 21, 2024).

Windows Terminal version

1.21.2911.0

Windows build number

10.0.19045.2604

Other Software

Node: v20.16.0
NPM: 10.8.1

Steps to reproduce

Here is the command I want to run on Windows Terminal:

pm2 start C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app -- --port 3000

If I run it in the Windows Terminal, I will get this error:

error: unknown option `--port'.

The same error will appear in the Powershell. But it will succeed in the Command Line.

Is there a way to solve this problem?

Expected Behavior

The port number parameter can be passed to the command line successfully.

Actual Behavior

error: unknown option `--port'.

Originally created by @hh54188 on GitHub (Nov 21, 2024). ### Windows Terminal version 1.21.2911.0 ### Windows build number 10.0.19045.2604 ### Other Software Node: v20.16.0 NPM: 10.8.1 ### Steps to reproduce Here is the command I want to run on Windows Terminal: ``` pm2 start C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app -- --port 3000 ``` If I run it in the Windows Terminal, I will get this error: > error: unknown option `--port'. The same error will appear in the Powershell. But it will succeed in the Command Line. Is there a way to solve this problem? ### Expected Behavior The port number parameter can be passed to the command line successfully. ### Actual Behavior error: unknown option `--port'.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 08:17:36 +00:00
Author
Owner

@DHowett commented on GitHub (Nov 21, 2024):

When you say “in Windows Terminal,” is there a chance you mean “in PowerShell”?

Terminal supports running different shells, like PowerShell and Command Prompt.

If you are seeing a difference in argument handling, there is a chance you are not using the shell you are expecting.

EDIT: ah, I see you included that info in your original issue.

@DHowett commented on GitHub (Nov 21, 2024): ~~When you say “in Windows Terminal,” is there a chance you mean “in PowerShell”?~~ ~~Terminal supports running different shells, like PowerShell and Command Prompt.~~ ~~If you are seeing a difference in argument handling, there is a chance you are not using the shell you are expecting.~~ EDIT: ah, I see you included that info in your original issue.
Author
Owner

@DHowett commented on GitHub (Nov 21, 2024):

Is there a way to solve this problem?

You can run Command Prompt inside Windows Terminal. Please consult the dropdown menu for either a one-off option to run Command Prompt or a permanent option to configure your “Default Profile”.

@DHowett commented on GitHub (Nov 21, 2024): > Is there a way to solve this problem? You can run Command Prompt inside Windows Terminal. Please consult the dropdown menu for either a one-off option to run Command Prompt or a permanent option to configure your “Default Profile”.
Author
Owner

@elsaco commented on GitHub (Nov 21, 2024):

@hh54188 in pwsh try using quotes or escape the double hyphen.

Sample output:

PS C:\Users\WDAGUtilityAccount> pm2 start C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app '--' --port 3000
[PM2][ERROR] Script not found: C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server
PS C:\Users\WDAGUtilityAccount> pm2 start .\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-ser
ver-app -- --port 3000

  error: unknown option `--port'

PS C:\Users\WDAGUtilityAccount> pm2 start .\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app `-- --port 3000
[PM2] Starting C:\Users\WDAGUtilityAccount\AppData\Roaming\npm\node_modules\http-server\bin\http-server in fork_mode (1 instance)
[PM2] Done.
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ http-server-app    │ fork     │ 0    │ online    │ 0%       │ 45.6mb   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
@elsaco commented on GitHub (Nov 21, 2024): @hh54188 in pwsh try using quotes or escape the double hyphen. Sample output: ``` PS C:\Users\WDAGUtilityAccount> pm2 start C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app '--' --port 3000 [PM2][ERROR] Script not found: C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server PS C:\Users\WDAGUtilityAccount> pm2 start .\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-ser ver-app -- --port 3000 error: unknown option `--port' PS C:\Users\WDAGUtilityAccount> pm2 start .\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app `-- --port 3000 [PM2] Starting C:\Users\WDAGUtilityAccount\AppData\Roaming\npm\node_modules\http-server\bin\http-server in fork_mode (1 instance) [PM2] Done. ┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐ │ id │ name │ mode │ ↺ │ status │ cpu │ memory │ ├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤ │ 0 │ http-server-app │ fork │ 0 │ online │ 0% │ 45.6mb │ └────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘ ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22581