You can run a batch script that first calls env.bat and then does something else. You can also specify environment variables in <exec> by calling <env>.

- Alexey.

Barry Andrews wrote:

Thanks Alexey! But how can you execute the batch file within the <exec> task? You can't do a nested <exec> can you?


thanks,

Barry



-----Original Message-----
From: "Alexey N. Solofnenko" <[EMAIL PROTECTED]>
Sent: Jun 29, 2004 11:23 PM
To: Ant Users List <[EMAIL PROTECTED]>
Subject: Re: How to set environment via batch script

When you start a new process only that process get new environment - it is not propagated back into parent process. You need to execute env.bat just before ANT or within <exec> task, if the task requires env.bat to run.

- Alexey.

Barry Andrews wrote:



Hello,
I want to be able to invoke a batch script on Windows 2000 that sets up some environment variables. I know that I can use nested <env> elements with <exec>, but I really need to be able to run this script.


<exec executable="cmd.exe">
   <arg line="/c env.bat"/>
</exec>

The script does run because I can see the output in the console, but the environment variables are not set when the JVM exits.

Is there a way to do this?


many thanks,

Barry


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to