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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you set ENVIRONMENT vars using VB?

Status
Not open for further replies.

christheprogrammer

Programmer
Jul 10, 2000
258
CA
I need to run an old dos app, and many environment variables must be set each time the batch file is run.&nbsp;&nbsp;This is so that the C compiler knows where to find certain things (the program automates C compilations/logfile creations, etc.).&nbsp;&nbsp;All I need is to be able to set the env. vars after shelling command.com...... Anyone know how to issue dos commands to a shelled msdos window?????<br>THanks in advance,<br>Chris
 
Chris,<br><br>Have a look in the FAQ called:<br><br>&quot;How do I run and control a DOS console?&quot;<br><br>I've never used this to set env vars - let me know how you get on with it and I'll update the FAQ to reflect that.<br><br>I have to admit - I would have just modified the batch file you call so that it set's its own env vars - is there some reason you don't want to do that? <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Chris - <br><br>Mike's suggestion is a good one.&nbsp;&nbsp;You'd just put the &quot;Set&quot; commands in there ahead of the call to whatever program you wanted to run.&nbsp;&nbsp;When the program finishes and the batch file exits, that command shell goes away, along with your environmental vars, so you don't end up polluting your main environment.<br><br>Chip H.<br>
 
thanks guys, yes I figuered out that i could just put the set commands into the batch file.&nbsp;&nbsp;Sometimes I feel so dumb.. anyways thanks for your replies!<br>Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top