zeonism
Posts: 13
Joined: Mon Sep 18, 2017 8:31 am

Exit silent installation when a batch file returns FALSE

Hi Support,

I wonder how to implement the installer to exit the silent installation when a batch file returns FALSE.
The batch file basically checks if the computer manufacturer is, for example, Asus Computers by running a WMIC command.
It will return TRUE if it's Asus Computer and the silent installation continues and if it returns FALSE the silent installation should exit right away.

What is the best way to implement this?

Andy
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: Exit silent installation when a batch file returns FALSE

Hello Andy,

In order to achieve what you want, you can launch your BAT file using a "Launch File" predefined custom action. For more details about this, you can follow our "How to launch a CMD or BAT file" tutorial.

Then make sure that "Wait for custom action to finish before proceeding" and "Fail installation if custom action returns an error" options from "Execution Options" tab are ticked. Windows installer interprets return codes equal to "0" as a success and return codes different from "0" as a failure. So, you should make sure your .BAT file has an exit code of 0 for success and different from 0 for failure.

Hope that helps!

If you have any further questions or doubts, don't hesitate to contact me.

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
zeonism
Posts: 13
Joined: Mon Sep 18, 2017 8:31 am

Re: Exit silent installation when a batch file returns FALSE

Works great! Thank you.
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: Exit silent installation when a batch file returns FALSE

You're welcome! I am glad I could help.

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”