MScholtes / PS2EXE

Module to compile powershell scripts to executables
Other
1.24k stars 199 forks source link

Declaring a parameter as [string] does not pass on value of parameter if [switch] params also declared. #113

Closed HTWingNut closed 11 months ago

HTWingNut commented 11 months ago

I set up parameters:

param (
    [string]$path = "?",
    [string]$log = "?"
)

This works

If I set up switch params with it:

param (
    [string]$path = "?",
    [string]$log = "?",
    [switch]$create = $true
)

It will return strings as switch and as "true" if assigned default value. If I remove the [string] declaration it works fine.

param (
    $path = "?",
    $log = "?",
    [switch]$create = $true
)
HTWingNut commented 11 months ago

seems it's a powershell (and my) issue not ps2exe... sorry about that.