Problem passing arguments to exe file

Issue #240 resolved
Madhu P. Nair created an issue

Visual Studio code version: 1.41.1

PoshTools version: [5.7.0] - (1-18-2020)

Name Value


PSVersion 5.1.16299.98
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.98
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1


Packaged exe is not accepting input parameter values with space in it. For example:

script:

[CmdletBinding()] 
param 
(
    [Parameter(Mandatory = $false)]
    [string]$myparam
)

Write-Host $myparam

.\MyScript.exe -myparam "myparam value"
A positional parameter cannot be found that accepts argument 'value'.
At line:1 char:1

  • & { [CmdletBinding()]
  • ```
    • CategoryInfo : InvalidArgument: (:) [], ParameterBindingException
    • FullyQualifiedErrorId : PositionalParameterNotFound ```

.\MyScript.exe -myparam 'myparam value'
A positional parameter cannot be found that accepts argument 'value'.
At line:1 char:1

  • & { [CmdletBinding()]
  • ```
    • CategoryInfo : InvalidArgument: (:) [], ParameterBindingException
    • FullyQualifiedErrorId : PositionalParameterNotFound

```

PS I:\WorkData\SCRIPTS\POWERSHELL\PowerShellProTools\Out>

If the value is entered without any space, there is no error.

.\MyScript.exe -myparam 'myparam'
myparam

Comments (3)

  1. Log in to comment