PowerShell: PowerShell 7.3 doesn't pass variable values / cmdlet results arguments to child processes when comma is present
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
When launching an executable from PowerShell, with $PSNativeCommandArgumentPassing <> "Legacy"
if the arguments contain a comma, the variables/cmdlets are evaluated, but the results of the evaluation don’t go to the child process.
C:\Windows\System32> $PSNativeCommandArgumentPassing = "Windows"
C:\Windows\System32> $x = "lame"
C:\Windows\System32> cmd /c echo x=$x
x=lame
C:\Windows\System32> cmd /c echo a,x=$x
a,x=$x
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo x=$x }
DEBUG: 2022-11-09 20:39:02.1548 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:39:02.1551 ParameterBinding Information: 0 : BIND argument [/c echo x=lame]
DEBUG: 2022-11-09 20:39:02.1702 ParameterBinding Information: 0 : CALLING BeginProcessing
x=lame
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo a,x=$x }
DEBUG: 2022-11-09 20:39:07.6131 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:39:07.6134 ParameterBinding Information: 0 : BIND argument [/c echo a,x=$x]
DEBUG: 2022-11-09 20:39:07.6194 ParameterBinding Information: 0 : CALLING BeginProcessing
a,x=$x
C:\Windows\System32> $PSNativeCommandArgumentPassing = "Standard"
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo x=$x }
DEBUG: 2022-11-09 20:39:22.6507 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:39:22.6510 ParameterBinding Information: 0 : BIND cmd line arg [/c] to position [0]
DEBUG: 2022-11-09 20:39:22.6513 ParameterBinding Information: 0 : BIND cmd line arg [echo] to position [1]
DEBUG: 2022-11-09 20:39:22.6515 ParameterBinding Information: 0 : BIND cmd line arg [x=lame] to position [2]
DEBUG: 2022-11-09 20:39:22.6681 ParameterBinding Information: 0 : CALLING BeginProcessing
x=lame
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo a,x=$x }
DEBUG: 2022-11-09 20:39:25.2418 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:39:25.2422 ParameterBinding Information: 0 : BIND cmd line arg [/c] to position [0]
DEBUG: 2022-11-09 20:39:25.2425 ParameterBinding Information: 0 : BIND cmd line arg [echo] to position [1]
DEBUG: 2022-11-09 20:39:25.2428 ParameterBinding Information: 0 : BIND cmd line arg [a,x=$x] to position [2]
DEBUG: 2022-11-09 20:39:25.2666 ParameterBinding Information: 0 : CALLING BeginProcessing
a,x=$x
C:\Windows\System32> $PSNativeCommandArgumentPassing = "Legacy"
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo x=$x }
DEBUG: 2022-11-09 20:39:36.2214 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:39:36.2218 ParameterBinding Information: 0 : BIND argument [/c echo x=lame]
DEBUG: 2022-11-09 20:39:36.2561 ParameterBinding Information: 0 : CALLING BeginProcessing
x=lame
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo a,x=$x }
DEBUG: 2022-11-09 20:39:38.4751 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:39:38.4755 ParameterBinding Information: 0 : BIND argument [/c echo a,x=lame]
DEBUG: 2022-11-09 20:39:38.4822 ParameterBinding Information: 0 : CALLING BeginProcessing
a,x=lame
C:\Windows\System32>
We can see that the cmdlet is executed (or attempted):
C:\Windows\System32> $PSNativeCommandArgumentPassing = "Standard"
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo cd=$(Get-Location) }
DEBUG: 2022-11-09 20:48:15.0675 ParameterBinding Information: 0 : BIND NAMED cmd line args [Get-Location]
DEBUG: 2022-11-09 20:48:15.0677 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Get-Location]
DEBUG: 2022-11-09 20:48:15.0679 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2022-11-09 20:48:15.0681 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Get-Location]
DEBUG: 2022-11-09 20:48:15.0683 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:15.0685 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:15.0687 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2022-11-09 20:48:15.0762 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:48:15.0767 ParameterBinding Information: 0 : BIND cmd line arg [/c] to position [0]
DEBUG: 2022-11-09 20:48:15.0770 ParameterBinding Information: 0 : BIND cmd line arg [echo] to position [1]
DEBUG: 2022-11-09 20:48:15.0773 ParameterBinding Information: 0 : BIND cmd line arg [cd=C:\Windows\System32] to position [2]
DEBUG: 2022-11-09 20:48:15.0943 ParameterBinding Information: 0 : CALLING BeginProcessing
cd=C:\Windows\System32
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo foo,cd=$(Get-Location) }
DEBUG: 2022-11-09 20:48:18.2709 ParameterBinding Information: 0 : BIND NAMED cmd line args [Get-Location]
DEBUG: 2022-11-09 20:48:18.2712 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Get-Location]
DEBUG: 2022-11-09 20:48:18.2714 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2022-11-09 20:48:18.2717 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Get-Location]
DEBUG: 2022-11-09 20:48:18.2719 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:18.2721 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:18.2723 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2022-11-09 20:48:18.2815 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:48:18.2819 ParameterBinding Information: 0 : BIND cmd line arg [/c] to position [0]
DEBUG: 2022-11-09 20:48:18.2821 ParameterBinding Information: 0 : BIND cmd line arg [echo] to position [1]
DEBUG: 2022-11-09 20:48:18.2824 ParameterBinding Information: 0 : BIND cmd line arg [foo,cd=$(Get-Location)] to position [2]
DEBUG: 2022-11-09 20:48:18.2999 ParameterBinding Information: 0 : CALLING BeginProcessing
foo,cd=$(Get-Location)
C:\Windows\System32> Trace-Command -PSHost -Name "ParameterBinding" { cmd /c echo foo,cd=$(Get-Locatio) }
DEBUG: 2022-11-09 20:48:24.7753 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-Default]
DEBUG: 2022-11-09 20:48:24.7756 ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2022-11-09 20:48:24.7759 ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: 2022-11-09 20:48:24.7762 ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2022-11-09 20:48:24.7765 ParameterBinding Information: 0 : BIND arg [The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.] to parameter [InputObject]
DEBUG: 2022-11-09 20:48:24.7768 ParameterBinding Information: 0 : BIND arg [The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.] to param [InputObject] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.7771 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-Default]
DEBUG: 2022-11-09 20:48:24.7774 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:24.7778 ParameterBinding Information: 0 : BIND NAMED cmd line args [Out-LineOutput]
DEBUG: 2022-11-09 20:48:24.7785 ParameterBinding Information: 0 : BIND arg [Microsoft.PowerShell.Commands.Internal.Format.ConsoleLineOutput] to parameter [LineOutput]
DEBUG: 2022-11-09 20:48:24.7803 ParameterBinding Information: 0 : COERCE arg to [System.Object]
DEBUG: 2022-11-09 20:48:24.7830 ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: 2022-11-09 20:48:24.7845 ParameterBinding Information: 0 : BIND arg [Microsoft.PowerShell.Commands.Internal.Format.ConsoleLineOutput] to param [LineOutput] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.7853 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Out-LineOutput]
DEBUG: 2022-11-09 20:48:24.7858 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-LineOutput]
DEBUG: 2022-11-09 20:48:24.7863 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:24.7868 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-LineOutput]
DEBUG: 2022-11-09 20:48:24.7873 ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2022-11-09 20:48:24.7878 ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: 2022-11-09 20:48:24.7885 ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2022-11-09 20:48:24.7890 ParameterBinding Information: 0 : BIND arg [The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.] to parameter [InputObject]
DEBUG: 2022-11-09 20:48:24.7895 ParameterBinding Information: 0 : BIND arg [The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.] to param [InputObject] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.7901 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [out-lineoutput]
DEBUG: 2022-11-09 20:48:24.7904 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:24.7911 ParameterBinding Information: 0 : BIND NAMED cmd line args [Format-Default]
DEBUG: 2022-11-09 20:48:24.7916 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Format-Default]
DEBUG: 2022-11-09 20:48:24.7920 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Format-Default]
DEBUG: 2022-11-09 20:48:24.7924 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:24.7928 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Format-Default]
DEBUG: 2022-11-09 20:48:24.7932 ParameterBinding Information: 0 : PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2022-11-09 20:48:24.7937 ParameterBinding Information: 0 : RESTORING pipeline parameter's original values
DEBUG: 2022-11-09 20:48:24.7946 ParameterBinding Information: 0 : Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2022-11-09 20:48:24.7954 ParameterBinding Information: 0 : BIND arg [The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.] to parameter [InputObject]
DEBUG: 2022-11-09 20:48:24.7967 ParameterBinding Information: 0 : BIND arg [The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.] to param [InputObject] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.7974 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [format-default]
DEBUG: 2022-11-09 20:48:24.7978 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:24.8372 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8377 ParameterBinding Information: 0 : BIND arg [True] to parameter [Off]
DEBUG: 2022-11-09 20:48:24.8381 ParameterBinding Information: 0 : COERCE arg to [System.Management.Automation.SwitchParameter]
DEBUG: 2022-11-09 20:48:24.8384 ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: 2022-11-09 20:48:24.8388 ParameterBinding Information: 0 : BIND arg [True] to param [Off] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.8392 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8395 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8399 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:24.8402 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:24.8406 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2022-11-09 20:48:24.8539 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8544 ParameterBinding Information: 0 : BIND arg [1] to parameter [Version]
DEBUG: 2022-11-09 20:48:24.8548 ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToPSVersionTransformationAttribute]
DEBUG: 2022-11-09 20:48:24.8553 ParameterBinding Information: 0 : result returned from DATA GENERATION: 1.0
DEBUG: 2022-11-09 20:48:24.8556 ParameterBinding Information: 0 : COERCE arg to [System.Version]
DEBUG: 2022-11-09 20:48:24.8560 ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: 2022-11-09 20:48:24.8564 ParameterBinding Information: 0 : Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: 2022-11-09 20:48:24.8568 ParameterBinding Information: 0 : BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.8571 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8575 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8578 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:24.8582 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:24.8585 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2022-11-09 20:48:24.8592 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8595 ParameterBinding Information: 0 : BIND arg [1] to parameter [Version]
DEBUG: 2022-11-09 20:48:24.8599 ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToPSVersionTransformationAttribute]
DEBUG: 2022-11-09 20:48:24.8604 ParameterBinding Information: 0 : result returned from DATA GENERATION: 1.0
DEBUG: 2022-11-09 20:48:24.8607 ParameterBinding Information: 0 : COERCE arg to [System.Version]
DEBUG: 2022-11-09 20:48:24.8610 ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: 2022-11-09 20:48:24.8614 ParameterBinding Information: 0 : Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: 2022-11-09 20:48:24.8618 ParameterBinding Information: 0 : BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: 2022-11-09 20:48:24.8621 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8625 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2022-11-09 20:48:24.8628 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2022-11-09 20:48:24.8632 ParameterBinding Information: 0 : CALLING ProcessRecord
DEBUG: 2022-11-09 20:48:24.8635 ParameterBinding Information: 0 : CALLING EndProcessing
Get-Locatio: The term 'Get-Locatio' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
DEBUG: 2022-11-09 20:48:24.8905 ParameterBinding Information: 0 : BIND NAMED native application line args [C:\Windows\system32\cmd.exe]
DEBUG: 2022-11-09 20:48:24.8912 ParameterBinding Information: 0 : BIND cmd line arg [/c] to position [0]
DEBUG: 2022-11-09 20:48:24.8917 ParameterBinding Information: 0 : BIND cmd line arg [echo] to position [1]
DEBUG: 2022-11-09 20:48:24.8928 ParameterBinding Information: 0 : BIND cmd line arg [foo,cd=$(Get-Locatio)] to position [2]
DEBUG: 2022-11-09 20:48:24.9049 ParameterBinding Information: 0 : CALLING BeginProcessing
foo,cd=$(Get-Locatio)
C:\Windows\System32>
Expected behavior
C:\Foo> docker run --rm -it --mount type=bind,src=$(Get-Location),dst=C:\target mcr.microsoft.com/windows/servercore:10.0.20348.887 powershell.exe
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.20348.859
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.859
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PS C:\>
Actual behavior
C:\Foo> docker run --rm -it --mount type=bind,src=$(Get-Location),dst=C:\target mcr.microsoft.com/windows/servercore:10.0.20348.887 powershell.exe
docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: '$(Get-Location)' mount path must be absolute.
See 'docker run --help'.
C:\Foo>
Error details
No response
Environment data
C:\> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 29 (21 by maintainers)
@conioh I think it’s fair feedback, that members of the team should provide more context and reasoning on changes (or at least link to other issues where it was discussed)
@JamesWTruher, may we know
@JamesWTruher, I ask again, after a month, may we know
CC @SteveL-MSFT Are these questions difficult to answer or is the information classified? Is it TOP SECRET and available only under a special access program? #professionalism_and_all_that_jazz
@JamesWTruher, I ask again, after more than two weeks, may we know
CC @SteveL-MSFT
On the meta issue, @SteveL-MSFT
That is encouraging to hear. 🤞for the future.
As for the present:
Your comment came not only after the initial, bewilderingly cavalier team-member response, but after a follow-up response that also failed to provide a reasoning (while making the spurious claim that “the new behavior requires that you use an expandable string”).
I do hope that a proper response is forthcoming, one that addresses the specific arguments made above, namely that this is bug that, even if the change were intentional, would have no conceptual justification, and is therefore an unacceptable breaking change.
@SteveL-MSFT, thank you for the reminder! I would like to remind you that that so far the responses here were not what I would consider professional. Elsewhere Mr. Klement has also expressed a similar view. I would love nothing more than that to achieve a professional discussion, and once we’re there we should strive to keep it so.
Please consider the long-term effects of ¹seemingly unjustified ²undocumented, ³breaking changes for which ⁴no explanation but “trust me, we had a reason” is given on trust towards you, PowerShell and the company you work for.
Great. Then it should be easy to remove this specialized code. Please do that.
Neither the blog post nor the documentation mention any of this. And what does “with” mean? And how does it make sense to execute the cmdlet but ignore its result? That’s doubly insane.
Not executing the cmdlet/script block if you’re not going to use its return value isn’t the bare minimum, it’s way below the minimum. Even assuming breaking everything and not expanding variables when they’re “with” commas is somehow fine, how do you consider this even remotely acceptable? You want to treat this as a “raw string”? Fine. then don’t execute it. 🤦
@mklement0, thanks. This is very helpful.
I’m sure there are lots of other bugs here (I know some of them up close ☹️), but this is a regression which makes it even worse.
Wow - that is very unfortunate. The workaround for now is to double-quote the argument (
cmd /c echo "a,x=$x"
).The problem isn’t Windows-specific; Unix repro:
/bin/echo a,$HOME
and even/bin/echo a, $HOME
; that is, a trailing unquoted,
in an argument prevents expansion of the next one.Note that there’s an older, similar bug:
/bin/echo -foo=$HOME
doesn’t expand either (there are several bugs related to-
-prefixed arguments):