Skip to content

[Bug] shim add with args staring with -- fails #6476

@refack

Description

@refack

Bug Report

Current Behavior

running:

> scoop shim add myshim C:\tools\myapp.exe -- --form there --to here

outputs:

scoop shim: Option --form not recognized.

also:

> scoop shim add myshim C:\tools\myapp.exe --% --form there --to here
scoop shim: Option --% not recognized.

Expected Behavior

Shim created with:

path = "C:\tools\myapp.exe"
args = --form there --to here

Additional context/output

The "stop parsing" atom in PowerShell syntax is --% no the POSIX --

Possible Solution

--- a/lib/getopt.ps1
+++ b/lib/getopt.ps1
@@ -32,7 +32,7 @@ function getopt([String[]]$argv, [String]$shortopts, [String[]]$longopts) {
         if ($arg -is [Int]) { $rem += $arg; continue }
         if ($arg -is [Decimal]) { $rem += $arg; continue }
 
-        if ($arg -eq '--') {
+        if ($arg -match '^--%?$') {
             if ($i -lt $argv.Length - 1) {
                 $rem += $argv[($i + 1)..($argv.Length - 1)]
             }

System details

  • Windows version: 11
  • OS architecture: 64bit
  • PowerShell version: 7.5.2
  • Additional software: -

Scoop Configuration

{
  "aria2-enabled": true,
  "aria2-warning-enabled": false,
  "autostash_on_conflict": true,
  "cat_style": "default",
  "debug": false,
  "gh_token": "gho_▌█▌▄▄▐▌▌█▄▌▐▌█▀███▀▀█▌▀▐▄▀▄▀▌▌▐█▌█▐▀",
  "global_path": false,
  "last_update": "2025-09-03T12:40:55.9418320-04:00",
  "root_path": "E:\\scoop",
  "scoop_branch": "develop",
  "scoop_repo": "https://github.com/ScoopInstaller/Scoop",
  "show_manifest": true,
  "use_external_7zip": true,
  "use_isolated_path": true,
  "use_sqlite_cache": false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions