Computing.Net > Forums > Programming > Batch script set environment vars?

Batch script set environment vars?

Reply to Message Icon

Original Message
Name: jdt
Date: June 10, 2005 at 11:49:07 Pacific
Subject: Batch script set environment vars?
OS: WindowsXP Pro\Linux 2.4.6
CPU/Ram: Intel Pentium III 900MHz
Comment:

I am trying to get Apache ant to work on Windows, the problem is that I have to
set environment variables, like so, set ANT_HOME=c:\ant, (you call those environment variables, right) and I have succesfully got ant working on Linux, but that is because changes made to environment variables in Linux are persistent, whereas ones on the command-line in Windows are not. Anyway, I was thinking, could I write a batch script to set the environment up, then launch cmd.exe?
Or, is there a way to get the changes to environment variables to be persistent. I have no experience with batch programming, but I have programming experience otherwise.
Thanks.

jdt


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: June 10, 2005 at 22:48:14 Pacific
Reply: (edit)

Hi jdt,

The line for a bat is simple. But as you say, that var is only accessable in that shell.

Try putting your set line in autoexec.bat in the root of the boot drive.



Report Offensive Follow Up For Removal

Response Number 2
Name: dtech10
Date: June 11, 2005 at 05:20:11 Pacific
Reply: (edit)

Hi jdt
1, Right click "My Computer"
2, Select "Properties"
3, Select "Advanced" tab
4, Click on "Environment Variables"
Here you can set your own variables.


Report Offensive Follow Up For Removal

Response Number 3
Name: Mechanix2Go
Date: June 11, 2005 at 05:36:42 Pacific
Reply: (edit)

Hi dtech,

Good one.

I must have been having a seƱor moment.

:0)



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch script set environment vars?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge