diff --git a/bin/npm.ps1 b/bin/npm.ps1 index 08fabb66761ce..77bc9a5777c80 100644 --- a/bin/npm.ps1 +++ b/bin/npm.ps1 @@ -37,7 +37,9 @@ if ($MyInvocation.Line) { # used "-Command" argument # Support pipeline input if ($MyInvocation.ExpectingInput) { - $input | Invoke-Expression "& `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS" + $input = (@($input) -join "`n").Replace("``", "````") + + Invoke-Expression "Write-Output `"$input`" | & `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS" } else { Invoke-Expression "& `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS" } diff --git a/bin/npx.ps1 b/bin/npx.ps1 index f3e8152b30cca..e89536bf3542a 100644 --- a/bin/npx.ps1 +++ b/bin/npx.ps1 @@ -37,7 +37,9 @@ if ($MyInvocation.Line) { # used "-Command" argument # Support pipeline input if ($MyInvocation.ExpectingInput) { - $input | Invoke-Expression "& `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS" + $input = (@($input) -join "`n").Replace("``", "````") + + Invoke-Expression "Write-Output `"$input`" | & `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS" } else { Invoke-Expression "& `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS" }