Repository navigation
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.The question is answered.WG-Engine-ParameterBinder
Description
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
Have a program that just prints out it's args:
using System;
using System.Linq;
namespace ConsoleApp29
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Arguments:");
args.ToList().ForEach(arg => Console.WriteLine(arg));
}
}
}Invoke the program with & and pass some params.
Expected behavior
& ".\ConsoleApp29.exe" @("a", '"a"')
Arguments:
a
aActual behavior
& ".\ConsoleApp29.exe" @("a", '"a"')
Arguments:
a
"a"Error details
The "" are no longer stripped from the argument in 7.2.0-preview9, while in 7.1.3 they are stripped.Environment data
$psversiontable
Name Value
---- -----
PSVersion 7.2.0-preview.9
PSEdition Core
GitCommitId 7.2.0-preview.9
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Reacted by Medeni Baykal
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.The question is answered.WG-Engine-ParameterBinder
Activity
Haplois commentedon Aug 30, 2021
We also see this in our repository, when executing this line:
https://github.com/microsoft/testfx/blob/a5fc7c9c91d5de10fe3824d86872d31f847a682d/scripts/Build.ps1#L225
SeeminglyScience commentedon Aug 30, 2021
This is due to the experimental feature
PSNativeCommandArgumentParsing. As a workaround, you can disable the feature or control it with this variable:nohwnd commentedon Aug 30, 2021
Thanks Patrick.
Medeni Baykal (@Haplois) This should also work, when relying on scoping to reset it for us:
Haplois commentedon Aug 30, 2021
Thanks Jakub Jareš (@nohwnd), Patrick Meinecke (@SeeminglyScience).
jborean93 commentedon Aug 30, 2021
Just as an FYI this should be the desired behaviour as it is escaping the values correctly. It will allow you to do
my.exe '{"foo": "bar"}'without you having to manually escape the double quotes yourself. The only exceptions would be executables that don't follow the standard MS C argument escaping convention which there are some out there.