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 invocation of WSH scripts (VBScript, JScript) with arguments #15289
Comments
@mklement0 good find. Here's the stack trace: PS> gerr
Exception :
Type : System.Management.Automation.ApplicationFailedException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Program 't.vbs' failed to run: Only one of Arguments or ArgumentList may be used.At line:1 char:1
+ .\t.vbs foo
+ ~~~~~~~~~~~.
HResult : -2146233087
CategoryInfo : ResourceUnavailable: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : NativeCommandFailed
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : -1
Line : .\t.vbs foo
PositionMessage : At line:1 char:1
+ .\t.vbs foo
+ ~~~~~~~~~~~
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 't.vbs' failed to run: Only one of Arguments or ArgumentList may be used.At line:1 char:1
+ .\t.vbs foo
+ ~~~~~~~~~~~.
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 : .\t.vbs foo
PositionMessage : At line:1 char:1
+ .\t.vbs foo
+ ~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1 |
/cc @JamesWTruher for insight. |
I've also encountered this issue when running python scripts directly. ResourceUnavailable: Program 'test.py' failed to run: Only one of Arguments or ArgumentList may be used.At line:1 char:1 Stack 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 1 Edit: I should mention that this issue is fixed when setting |
yep - this is a bug for which I have a fix |
@JamesWTruher any chance we can get your fix in for this any time soon? |
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. |
1 similar comment
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. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
Note: The common denominator here is invocation of scripts implicitly via WSH (Windows Scripting Host,
cscript.exe
andwscript.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 behavior
The test should pass.
Actual behavior
The test fails with the following error:
In versions prior to PowerShell Core 7.2.0-preview.5 (and with
$PSNativeCommandArgumentPassing= 'Legacy'
), the test passes.Environment data
The text was updated successfully, but these errors were encountered: