PDA

View Full Version : How to execute a script/batch file from install anywhere



Chaitanya05444
04-14-2016, 12:01 AM
Hi,

I am having a simple .bat file in my project folder which needs to create a folder (mkdir "testfolder") in the installation directory.
How i need to execute this .bat file using execute script/batch from IA 2015SP1 ??


Thanks and Regards,
Chaitanya.

Nischal B V
04-15-2016, 02:39 AM
Hello,

Follow the below steps to achieve the script or batch execution using InstallAnywhere.

1.Add the Execute Script/batch file Action as part of your project settings in the respective Sequence phase.
2. In the properties customizer section of the Execute Script/batch file Action, There is text area called Script: where you need to add your platform specific lines of code(Note: the commands must know in which directory it has to execute, so add cd $USER_INSTALL_DIR$ as your first line of code in the script area).
3. The text area allows the end user to leverage the InstallAnywhere Variables like "USER_INSTALL_DIR" in the user script.
4. Add a Check platform rule to the action, to decide the running platform based on script.
5.Build and run the installer.

Solution for your sample create folder task:
batch-
cd $USER_INSTALL_DIR$
mkdir testfolder

script- new folder with a test file)
cd $USER_INSTALL_DIR$
mkdir testfolder
cd $USER_INSTALL_DIR$/ testfolder
touch testfile.txt

Additonal Suggestion: It is also possible to make use of Execute Command action which runs the script or batch file as a whole. By referring the .sh or .bat file in the command line.(Refer manual for more help)

Let me know if this works for you.

Thank You