Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

When calling cmd script, comma in string is not preserved  #11295

Copy link
Copy link
@jiasli

Description

@jiasli
Issue body actions

Steps to reproduce

Create a batch file mybatch.cmd containing:

@echo off
echo %1
echo %2

In PowerShell call it with

PS C:\Users\me> .\mybatch.cmd "a,b"
a
b
PS C:\Users\me> .\mybatch.cmd 'a,b'
a
b
PS C:\Users\me> .\mybatch.cmd --% "a,b"
"a,b"
ECHO is off.  # this is expected in cmd
PS C:\Users\me> .\mybatch.cmd --% 'a,b'
'a
b'            # this is expected in cmd

Expected behavior

Comma inside the string should be preserved, like when calling it in cmd:

mybatch.cmd "a,b"
"a,b"
ECHO is off.

Actual behavior

Comma is parsed as array.

Environment data

$PSVersionTable 

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    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 aResolution-AnsweredThe question is answered.The question is answered.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.