bbuchner
Posts: 7
Joined: Fri Jun 15, 2012 10:03 am

Running a batch file that needs an argument

Hello,

I am currently evaluating the Advanced Installer for company purposes and have tried to build an installer that should start a service on the target computer. For this, I have to use a already existing batch file that needs an argument to start the service. The command prompt for this has to be run as admin. For some reason I am not able to accomplish this task, even after following several threads that I have found in this forum. Can somebody give me some advice?

Regards
Benedikt Buchner
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Running a batch file that needs an argument

Hi Benedikt and welcome to our forums,

Thank you for your interest in Advanced Installer.

There are several method that you can use to start a service from Advanced Installer.

The simplest one is to use our built-in support, from Services page. There you can add a simple "Control Operation" and configure it as desired.

If the service requires a custom method to start it, than you can launch your BAT using a custom action. To make sure the custom action runs with full admin privileges you need to set it as "Deferred with no Impersonation".

If you have other questions please let me know.

Also, please do not duplicate a forums post over e-mail, they have the same priority for us and you will get the same answer.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bbuchner
Posts: 7
Joined: Fri Jun 15, 2012 10:03 am

Re: Running a batch file that needs an argument

Hello Bogdan,

Thank you very much for the quick answer. I have tried your suggestion to use the built in Service Page to solve my issue. My problem is that on testing the generated msi, the installer complains about missing rights to install system services. What can this be?

I have already tried to use the custom action page to start the .bat. Here I have the problem that I can not find the place where I can enter the needed argument that the .bat file needs to install the service. What I mean is that I have to simulate using the command line, where the input would be:

Code: Select all

C:\application\bin\service.bat install
Regards
Benedikt
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Running a batch file that needs an argument

Hi Benedikt,
My problem is that on testing the generated msi, the installer complains about missing rights to install system services. What can this be?
Make sure the package is set to install per-machine, requiring admin rights. This setting is available in Install Parameters page.
I have already tried to use the custom action page to start the .bat...
The parameter is set in the command line field of the custom action mentioned in the article, exactly after the reference to the BAT file. So you would get something like this:

Code: Select all

[#service.bat] install
Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bbuchner
Posts: 7
Joined: Fri Jun 15, 2012 10:03 am

Re: Running a batch file that needs an argument

Hi Bogdan,

Thanks again, your last tip resolved my issue. Great help!

I have another question: I know it is possible to search for a folder using the advanced installer. But is it possible to first perform a search and then share that folder in the network of the target machine?

Regards,
Benedikt
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Running a batch file that needs an argument

Hi Benedikt,

Unfortunately with the available predefined folder functionality, the share settings in your installation package will not overwrite the share settings on the target machine if the folder is already present at installation time.
If you really need this you could try to implement it from within your own custom action.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”