Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental feature PSNativeCommandArgumentPassing breaks cmd /c calls with embedded double quotes #15239

Closed
mklement0 opened this issue Apr 15, 2021 · 4 comments
Assignees
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-No Activity Issue has had no activity for 6 months or more WG-Engine core PowerShell engine, interpreter, and runtime

Comments

@mklement0
Copy link
Contributor

mklement0 commented Apr 15, 2021

See also: #15250, #15261, #15276 - see overview in #15143.

The new-in-preview.5 PSNativeCommandArgumentPassing experimental feature aims to fix the longstanding problem with passing arguments to external programs, notably arguments with embedded " chars. and empty-string arguments. (see #1995 (comment) for a summary of the previously required workarounds; #14692 is the PR that implemented the experimental feature).

The experimental feature:

As explained in #14747 (comment), the old, broken behavior must be retained in this very specific scenario, because cmd.exe actually requires this broken behavior.

Steps to reproduce

Note: To see the problem, you must use PowerShell Core 7.2.0-preview.5, with experimental feature PSNativeCommandArgumentPassing enabled and preference variable $PSNativeCommandArgumentPassing set to 'Standard' (the default).

cmd /c 'echo "3"'
cmd /c "echo `"$(1+2)`""

(Note that cmd.exe's internal echo command retains double-quoting as passed on the command line.)

Expected behavior

"3"
"3"

This is the old - and in this exceptional case correct - behavior.

Actual behavior

\"3\"
\"3\"

Embedded " chars. were passed escaped as \" - while this is generally the right thing to do, it isn't when calling cmd /c or cmd /k with a command line passed as a single string.

Environment data

PowerShell Core 7.2.0-preview.5
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

2 similar comments
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-No Activity Issue has had no activity for 6 months or more labels Nov 16, 2023
Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-No Activity Issue has had no activity for 6 months or more WG-Engine core PowerShell engine, interpreter, and runtime
Projects
None yet
Development

No branches or pull requests

4 participants