Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to set evironment variables for a specific application

Status
Not open for further replies.

darrellblackhawk

Programmer
Aug 30, 2002
846
US
Hello,

I have two compilers on my system and would like to switch environment variables when one of them starts up.

Visual Studio runs as the normal development environment, but I also have ‘Open WatCom’ to develop older C/C++/Win32/Dos/etc. style applications.

I'd like certain environment variables to be specific to WatCom when it is invoked from the "Start Menu". The ones in question are the LIB, INCLUDE, and Path variables.

Should I just create two batch files to set/reset the environment variables in question before and after I invoke WatCom?

What I would really like, is for the environment variables to be changed when WatCom is invoked and changed back to their original values when it exits without having to run batch programs before and after running WatCom.

Thanks,

Darrell
 
Excuse my ignorance, but can the batch file set your variables, then run the the .exe and then set new variables when the .exe has completed. If it could do something like that then you could just click on the batch file and use it as a sort of shortcut to run your program. Like I said, excuse my ignorance.
 
Linney,

No, you're not ignorant. Because what you suggest, does work.

That is probably the way I'll handle it, but I was hoping for something more elegant - like tracking the current state of the settings before and after invoking certain functions of the applications.

Unfortunately, I probably won't be able to run the two compilers at the same time, since they both expect environment variables named the same, and running one when the other has its' variables "in play" bugs-out the current one.

Of course I could run the compilation at the command line and encapsulate that within a batch run, but that negates the productivity of using an IDE.

Rats!

Thanks for the comment.

Darrell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top