Run Batch from SupportFiles


I am trying to execute following code to remove reader setup before installing my msi.

Execute-Process -FilePath “$envWinDir\System32\cscript.exe” -Parameters “’$dirSupportFiles\Cleaner1.vbs’” -WindowStyle ‘Hidden’

Everytime it runs, it gives error: [Pre-Installation] :: Execution failed with exit code [1]. and did not uninstall anything from pc and gives installation failed message.

Vbs files when ran externally is working good. No issues. But when executing from .ps1 it gave this error, any suggestion.

I am able to figure out my mistake on this. Thanks.

I am getting another challenge though that is command window opens up which I do not want users to see. I am using -windowStyle ‘hidden’ switch but it does not seem to do anything.

Any advise on how I can stop cmd window popping up while calling uninstall.bat file?

-createnoWindow switch used to resolve this issue.