Sorlov.PowerShell icon indicating copy to clipboard operation
Sorlov.PowerShell copied to clipboard

making exe from a script having argument seems to be not working

Open orlith opened this issue 4 years ago • 1 comments

Hello I'm trying to convert to an exe file a simple script that needs 2 arguments. Running the ps1 populates the 2 variable with the 2 arguments I passed Running the exe (made with the same ps1) returns only default value Investigating shows that variables are not populated .

Here is the simple code test.ps1 Param([STRING]$clipboard = "defaultvalue", [STRING]$APP = "test",[SWITCH]$SELECT) Write-Host "Text: $clipboardnAppli: $app"`

so running "test.exe param1 param2" returns text:defaultvalue Appli:test where runing t he ps1 returns : text:param1 Appli:param2

Building the exe using PS2EXE instead of New-SelfHostedPS solve my issue. With PS2EXE conversion polulating variables from a passed arguments works fine.

Is that bug or am I doing something wrong ?

Thx

orlith avatar Oct 21 '20 12:10 orlith

Looking into this. Not sure if I will fix sue to the severe lag in the library (have not been kept up 2 date). Will update as soon as I had a chance to check it out.

DSorlov avatar Jan 02 '21 21:01 DSorlov