So, basically it sounds like you are trying to setup some kind of smoke test environment.
I suggest you decide how involved your build process will be and maybe break it down into pieces to better manage it. 1) Build environment scripts: Such as your build.xml ant script that is kicked off from your build.bat file 2) A properties file for your project to reflect what variables you want to use for the build: Such as test.product=true With the test.product variable set to anything, then in your build.xml you can check the variable and if set, then run the target to setup and test your product, IE: <target name="install_and_test" if="${test.product}"> <exec executable="cmd" failonerror="true" output="install.log"> <arg line="/c PATH_TO_YOUR_INSTALL_BAT/install.bat AND_ANYPARAMETERS_YOU_WANT_TO_PASS seperated by spaces, can be ${ANT VARIABLES}"/> </exec> <exec executable="cmd" failonerror="true" output="test.log"> <arg line="/c PATH_TO_YOUR_TEST_BAT/test.bat AND_ANYPARAMETERS_YOU_WANT_TO_PASS seperated by spaces, can be ${ANT VARIABLES}"/> </exec> </target> You can also use the ANT optional jars to use If/Then statements directly in the ANT script and set the test.product to true or false and do something different depending upon which value is entered: <target name="install_and_test"> <if> <equals arg1="${test.product}" arg2="true" /> <then> <exec executable="cmd" failonerror="true" output="install.log"> <arg line="/c PATH_TO_YOUR_INSTALL_BAT/install.bat AND_ANYPARAMETERS_YOU_WANT_TO_PASS seperated by spaces, can be ${ANT VARIABLES}"/> </exec> <exec executable="cmd" failonerror="true" output="test.log"> <arg line="/c PATH_TO_YOUR_TEST_BAT/test.bat AND_ANYPARAMETERS_YOU_WANT_TO_PASS seperated by spaces, can be ${ANT VARIABLES}"/> </exec> </then> <elseif> <equals arg1="${test.product}" arg2="false" /> <then> DO SOMETHING ELSE </then> </elseif> <else> <fail>Invalid value entered for test.product property in build.properties file.</fail> </else> </if> </target> Of course you can always just use the -Dtest.product=true command line input for the variable instead of using a properties file. Just put your multiple batch files that you want to run into one batch file and that is the one to call/run from ANT: MY_BATCH_FILE.BAT @echo off call 1st_batch_file.cmd or .bat call 2st_batch_file.cmd or .bat call 3st_batch_file.cmd or .bat exit Above uses call if you want it to wait for each one to finish before moving forward with the next. John Hello, There are some interseting arguments to exec like spawn (standard is false) etc. I never tried this, so someone else might know exactly. But I think it is worth a try to use the exec task for a test and see what happens. I think it is possible to keep the settings of a Batchfile you run. Greetings -- Jürgen Knuplesch Geschäftsführer: Uwe Seltmann HRB Stuttgart 17655 USt-IdNr.: DE 811944121 -----Ursprüngliche Nachricht----- Von: Shawn Castrianni [mailto:shawn.castria...@halliburton.com] Gesendet: Freitag, 13. Februar 2009 09:36 An: 'Ant Users List' Betreff: RE: setup environment for java task Thanks for the suggestion, but here is my problem: 1. These batch files are used at runtime from an end user after installing the product with an installer. 2. Therefore, these batch files cannot be converted to ANT as that would duplicate the logic and could get out of sync 3. I am trying to recreate an end user's runtime environment with ANT so that I can launch our application or run unit tests with the same environment which is why I want to execute those same batch files 4. executing each batch file in an exec task only affects the process spawned by the exec task and is not remembered from one batch file to the next so when I finally launch my java class, that environment from the batch files is already gone, I think --- Shawn Castrianni -- View this message in context: http://www.nabble.com/setup-environment-for-java-task-tp21991537p22728095.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org