You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Experimental feature PSNativeCommandArgumentPassing breaks invocation of WSH scripts (VBScript, JScript) with arguments #15289
Note: The common denominator here is invocation of scripts implicitly via WSH (Windows Scripting Host, cscript.exe and wscript.exe), which therefore equally affects VBScript and JScript script files.
Steps to reproduce
On Windows, assuming that experimental feature PSNativeCommandArgumentPassing is enabled (and $PSNativeCommandArgumentPassing is set to 'Standard'):
Expected no exception to be thrown, but an exception "
Program 't.vbs' failed to run: Only one of Arguments or ArgumentList may be used. ...
" was thrown.
In versions prior to PowerShell Core 7.2.0-preview.5 (and with $PSNativeCommandArgumentPassing= 'Legacy'), the test passes.
changed the title [-]Experimental feature PSNativeCommandArgumentPassing breaks invocation of VBScripts with arguments[/-][+]Experimental feature PSNativeCommandArgumentPassing breaks invocation of WSH scripts (VBScript, JScript) with arguments[/+]on Apr 22, 2021
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 commented on Nov 16, 2023
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.
Activity
SteveL-MSFT commentedon Apr 22, 2021
Michael Klement (@mklement0) good find. Here's the stack trace:
[-]Experimental feature PSNativeCommandArgumentPassing breaks invocation of VBScripts with arguments[/-][+]Experimental feature PSNativeCommandArgumentPassing breaks invocation of WSH scripts (VBScript, JScript) with arguments[/+]daxian-dbw commentedon May 3, 2021
/cc James Truher (@JamesWTruher) for insight.
End-of-Eternity commentedon May 25, 2021
I've also encountered this issue when running python scripts directly.
For example
test.py someargswill throw the errorStack trace:
Exception : Type : System.Management.Automation.ApplicationFailedException ErrorRecord : Exception : Type : System.Management.Automation.ParentContainsErrorRecordException Message : Program 'test.py' failed to run: Only one of Arguments or ArgumentList may be used.At line:1 char:1 + ./test.py someargs + ~~~~~~~~~~~~~~~~~~. HResult : -2146233087 CategoryInfo : ResourceUnavailable: (:) [], ParentContainsErrorRecordException FullyQualifiedErrorId : NativeCommandFailed InvocationInfo : ScriptLineNumber : 1 OffsetInLine : 1 HistoryId : -1 Line : ./test.py someargs PositionMessage : At line:1 char:1 + ./test.py someargs + ~~~~~~~~~~~~~~~~~~ CommandOrigin : Internal ScriptStackTrace : at <ScriptBlock>, <No file>: line 1 TargetSite : Name : InitNativeProcess DeclaringType : System.Management.Automation.NativeCommandProcessor, System.Management.Automation, Version=7.2.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35 MemberType : Method Module : System.Management.Automation.dll StackTrace : at System.Management.Automation.NativeCommandProcessor.InitNativeProcess() at System.Management.Automation.NativeCommandProcessor.Prepare(IDictionary psDefaultParameterValues) at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues) at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream) at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) --- End of stack trace from previous location --- at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext) at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) Message : Program 'test.py' failed to run: Only one of Arguments or ArgumentList may be used.At line:1 char:1 + ./test.py someargs + ~~~~~~~~~~~~~~~~~~. Data : System.Collections.ListDictionaryInternal InnerException : Type : System.InvalidOperationException TargetSite : Name : Start DeclaringType : System.Diagnostics.Process MemberType : Method Module : System.Diagnostics.Process.dll StackTrace : at System.Diagnostics.Process.Start() at System.Management.Automation.NativeCommandProcessor.InitNativeProcess() Message : Only one of Arguments or ArgumentList may be used. Source : System.Diagnostics.Process HResult : -2146233079 Source : System.Management.Automation HResult : -2146233087 CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException FullyQualifiedErrorId : NativeCommandFailed InvocationInfo : ScriptLineNumber : 1 OffsetInLine : 1 HistoryId : -1 Line : ./test.py someargs PositionMessage : At line:1 char:1 + ./test.py someargs + ~~~~~~~~~~~~~~~~~~ CommandOrigin : Internal ScriptStackTrace : at <ScriptBlock>, <No file>: line 1Edit: I should mention that this issue is fixed when setting
$PSNativeCommandArgumentPassing="Standard"JamesWTruher commentedon May 27, 2021
yep - this is a bug for which I have a fix
kilasuit commentedon May 18, 2022
James Truher (@JamesWTruher) any chance we can get your fix in for this any time soon?
microsoft-github-policy-service commentedon Nov 16, 2023
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 commentedon Nov 16, 2023
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 commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.