Open ajkessel opened 1 month ago
Hello @ajkessel,
there are two errors in your script:
Greetings
Markus
Thanks for the tips. So is there a recommended "best practice" way to implement -help
with a compiled script? Just manually process the switch and output the help, rather than relying on PowerShell's built-in functionality that converts parameter descriptions to a help message?
Hello @ajkessel,
I'm sorry to say that I found no easy way to implement an "automatic" help. I will further investigate this but I guess a solution will require an extension to PS2EXE.
Interesting is that the project PS2EXE exists for several years now and you are the first to realise that there is a basic function missing.
Greetings
Markus
Try this approach
@ajkessel
`if ($args -contains '-help' -or $args -contains '/help' -or $args -contains '--help') { Write-Host @" Usage: script.exe --help or /help
Parameters:
---help :Show this help information.
--switch1
Hello @ajkessel,
I uploaded a new version of PS2EXE today. Executables generated with the new version have a parameter -? now that shows the help of the compiled Powershell script. "-? -detailed", "-? -examples" or "-? -full" can be used to get the appropriate help text.
Greetings
Markus
Thanks very much! I'll give it a try.
My script has a
-help
option which dumps the help screen, as shown in the excerpt below. But when compiled and run as an EXE,-help
shows the PowerShell help, not the script help. Is there a correct way to do this?