A dll can be invoked in Powershell; it takes several parameters, and I must run it several times while most of them stay the same, like this:
dotnet C:\App\App.dll AppCmd --MySwitch --Param1 ab --Param2 cd --Param30 xx
dotnet C:\App\App.dll AppCmd --MySwitch --Param1 ab --Param2 cd --Param30 yy
dotnet C:\App\App.dll AppCmd --MySwitch --Param1 ab --Param2 cd --Param30 zz --Param31 x:y y:z
I'd like to 'splat' the common parameters and manually write out only what is unique to each invocation, like:
$CommonArgs = @{
Param1 = 'ab',
Param2 = 'cd'
...
}
dotnet C:\App\App.dll AppCmd --MySwitch --Param30 xx -- @CommonArgs
dotnet C:\App\App.dll AppCmd --MySwitch --Param30 yy -- @CommonArgs
dotnet C:\App\App.dll AppCmd --MySwitch --Param30 zz --Param31 x:y y:z -- @CommonArgs
The App stops complaining about missing required parameters with the above syntax but it returns an error: Unhandled Exception: System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
I'm not sure whether that error message comes from the Application or Powershell itself.
I figured out splatting within Powershell functions and I read the --
should pass the parameters along to the dotnet call but apparently I'm still missing something. What is it?