Please feel free to provide feedback or file bugs here.

Command line parsing bug: spaces and trailing slash

There appears to be a bug parsing arguments to EXEs. If you pass a properly-quoted path that has spaces and a trailing slash, the rest of the command is lumped into the same argument. This also happens if you use a PowerShell variable to hold the path string.

To repro, first, install EchoArgs.exe (if using chocolatey: cinst -y echoargs). It demonstrates what arguments would get passed to any exe.

Then run:

PS> & EchoArgs "C:\spaces and trailing slash\" more args

Echo args shows that it all got lumped into one argument:

Arg 0 is <C:\spaces and trailing slash" more args>

If you remove the trailing slash, or the spaces, then it parses correctly ("more" and "args" are separate arguments):

PS> & EchoArgs "C:\noSpaces\Or\NoTrailingSlash" more args

Arg 0 is <C:\noSpaces\Or\NoTrailingSlash>
Arg 1 is <more>
Arg 2 is <args>

6 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)

    We’ll send you updates on this idea

    John B.John B. shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base