I am editing a script which I need to convert to exe. It has a few Write-Host
outputs of the status of the script when running. This causing the exe of the script to show up dialog boxes to the user forcing them to click OK 3 or 4 times before the script finishes.
I'd like to keep the Write-Host
output but just hide them (the dialog boxes) when the end user executes it from the exe.
Is this possible? I have looked into [void]
which the code doesn't like. The only other way I can get to work is just commenting it out with #
, but I'm sure there's a better way.
Example of what I want hidden/suppressed:
Write-Host "Current Status = " $status