Stéphane BARIZIEN

My feedback

  1. 2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    Stéphane BARIZIEN shared this idea  · 
  2. 7 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    4 comments  ·  PowerShell » PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    An error occurred while saving the comment
    Stéphane BARIZIEN commented  · 

    I confirm this issue, detected in the first place with a script that invokes ROBOCOPY.EXE (which is part of Windows).

    Here's my repro script, and its output (args.exe is my homegrown equivalent to EchoArgs, that I wrote a zillion years ago):

    ----------------------------8<---------------------------------------------
    $xmldata = @'
    <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
    <S>/s</S>
    <S>/xx</S>
    <S>/xo</S>
    <S>/np</S>
    <S>\\bar\c$\a b\</S>
    <S>E:\foo</S>
    </Objs>
    '@

    $xmlfile = Join-Path -Path $env:TEMP -ChildPath 'VSCodeArgsProblem_data.xml'
    $xmldata | Out-File $xmlfile
    $robocopy_args = Import-Clixml -LiteralPath $xmlfile
    Remove-Item -LiteralPath $xmlfile
    & args $robocopy_args

    ----------------------------8<---------------------------------------------

    -----------------------------------------
    Universal command line arguments debugger
    argv[0] = 's:\bin\windows\x86\Args.exe'
    -----------------------------------------
    argv[0]='s:\bin\windows\x86\Args.exe'
    strlen(argv[0]) = 27
    argv[1]='/s'
    strlen(argv[1]) = 2
    argv[2]='/xx'
    strlen(argv[2]) = 3
    argv[3]='/xo'
    strlen(argv[3]) = 3
    argv[4]='/np'
    strlen(argv[4]) = 3
    argv[5]='\\bar\c$\a b" E:\foo'
    strlen(argv[5]) = 20

    sum(strlen(argv[i])) = 58

    Current working directory: 'C:\Users\steph'

    GetCommandLine() = '"s:\bin\windows\x86\Args.exe" /s /xx /xo /np "\\bar\c$\a b\" E:\foo'

    strlen(GetCommandLine()) = 67

    ----------------------------8<---------------------------------------------

Feedback and Knowledge Base