We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Install and execute of batch scripts on different drive

Hi,

I have created installer which allows user to select drive during installation (C:\ , D:\ or E:\ ), I also have few batch scripts which needs to executed once all files have been copied by installer, these batch scripts are included in installer.

Issue I am facing is I am not sure which drive user will select for drive installation from Advanced installer ( it could be C:\,D;\,E:\,F:\...so..on..) based on that I need execute my batch script on installed files on that drive.

Can any one let me know how can resolve this issue

Thanks
Last edited by dhaval0129 on Wed Sep 25, 2013 6:04 pm, edited 1 time in total.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Installa and execute of batch scripts on different drive

Hello,

Please note that the APPDIR is the public property that contains the path for the installation folder.
Please take a look on our Properties article which may be useful to you. Please keep in mind that this property is referenced by formatted data type so it is resolved at runtime.

If you need any help, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

Thanks for reply, I have some commands in batch script its self which calls other batch file command, these batch files are copied by Advanced installer and it also has some dependencies , How do I solve this type of issues ?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Install and execute of batch scripts on different drive

Hello,

In order to launch a batch file, you can go in the Custom Actions page and add the predefined Launch file custom action with sequence.

In the custom action properties, in the File to Launch line just select your batch file. (e.g. [#MyFile.bat]). Also, if you want to launch a BAT file with parameters you can use a similar approach like in our pass parameter to batch file thread.

Please let us know if that helped, otherwise give us more details about your specific scenario.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

Yes, I am already doing that, I have added batch file in custom actions , but batch file that I added has commands which executes other different batch files which are copied during installation process, how should I approach this issue, those batch files do not know drive letter , it can be any c:\ , d:\, e:\ or f:\
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Install and execute of batch scripts on different drive

Hello,

In order to achieve that you can add in the main .BAT file the name of the files that you want to launch, one file name on each row.
e.g.:
File1.bat
File2.bat

Then in the custom action properties that is launching your main .BAt specify in the Working Directory field the [APPDIR] parameter.
This should make your .BAT file to launch the other ones without any issues.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

I tried it doesn't work, this is how my batch file looks like currently as below, Drive letter C:\ is static currently but installation drive can be any (d:\,e:\ & f:\)

@echo off
set JAVA_HOME=C:\TEST\JDK\jdk1.6.0_25
set JBOSS_HOME=C:\TEST\dcm4chee-psql-2.17.0
set PATH=%PATH%;C:\TESTo\JDK\jdk1.6.0_25\bin
C:\TEST\postgresql-9.0.4\bin\pg_ctl.exe register -N "PostgreSQL" -D "C:\TEST\postgresql-9.0.4\data"
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Install and execute of batch scripts on different drive

Hello,

Please note that there is no need to specify the path for the other files in your .bat file. Just specify the name of the related files, the path is specified when you use the [APPDIR] parameter in the Working Directory.
So, your .bat should look something like:
File1ToLaunch.bat
File2ToLaunch.bat
File3ToLaunch.bat

Please let us know if that helped, otherwise give us more details.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

but there are also couple of other commands which needs to be executed, before batch file needs to run , below is example , how do I achieve that

@echo off
set JAVA_HOME=C:\iCRco\JDK\jdk1.6.0_25
set JBOSS_HOME=C:\iCRco\dcm4chee-psql-2.17.0
set PATH=%PATH%;C:\iCRco\JDK\jdk1.6.0_25\bin
setx /M PATH "%PATH%;%JAVA_HOME%\bin"
C:\TEST\dcm4chee-psql-2.17.0\bin\install_service.bat server -install
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Install and execute of batch scripts on different drive

Hi,

Can you please try to set the Working directory to the folder path where your .bat files will be installed.

Also use the following command lines:

@echo off
set JAVA_HOME=C:\iCRco\JDK\jdk1.6.0_25
set JBOSS_HOME=C:\iCRco\dcm4chee-psql-2.17.0
set PATH=%PATH%;C:\iCRco\JDK\jdk1.6.0_25\bin
setx /M PATH "%PATH%;%JAVA_HOME%\bin"
install_service.bat server -install

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

Dan,

Can you give me some steps on how can do that ?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Install and execute of batch scripts on different drive

Hi,

Can you please send us the .AIP (project file) to support at advancedinstaller dot com and the related .BAT files so we can investigate them?

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

Attaching the file
Attachments
test.zip
(254.7 KiB) Downloaded 470 times
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Install and execute of batch scripts on different drive

Any Solution for this issue ?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Install and execute of batch scripts on different drive

Hello,

First of all I apologize for my delayed reply. I wasn't aware that you are using the 8.9 version of Advanced Installer.
I've attached a zip file that contains a sample which implement a similar scenario.

In the Custom Actions page I have added the Launch File or Open URL predefined custom action with sequence.
This custom action launch a .bat(run.bat) file that calls another .bat(bat2.bat) file which launch the notepad.exe application.

Please let us know if that helped.

Best regards,
Dan
Attachments
Sample.zip
(2.53 KiB) Downloaded 618 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”