PDA

View Full Version : Batch file setting environment vars at startup


David Librik
June 11th 03, 05:41 AM
How can I run a batch file which sets environment variables
at Windows startup?

I have a batch file which modifies several environment variables,
and I'd like the results to be globally set for the whole OS.
If I were using Windows 9x, I'd just call the batch file from my
AUTOEXEC.BAT, and the variables would be set for good at startup.
How do I do this on Windows 2000 and XP?

(If you're wondering why I don't just type the environment
variables into the System control panel, it's because they're
set by a Microsoft Visual C++ compiler script, VCVARS32.BAT.
You need to run this batch file in order to use the compiler
from the command line; it does a lot of complex stuff and
modifies your PATH and other variables accordingly. I don't
want to have to keep running this over and over again, every
time I pop open a Command Prompt.)

Any ideas? Thanks for any help,

- David Librik

Anando [MS-MVP]
June 11th 03, 07:18 PM
Hi David,
You can tell XP to parse AUTOEXEC.BAT at logon through TweakUI. Under
TweakUI go to the Logon section and put a check beside "Parse AUTOEXEC.BAT
at logon".

--
Anando, MS-MVP

Best tweaking tool for Windows XP-TweakUI
http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp

"David Librik" > wrote in message
...
> How can I run a batch file which sets environment variables
> at Windows startup?
>
> I have a batch file which modifies several environment variables,
> and I'd like the results to be globally set for the whole OS.
> If I were using Windows 9x, I'd just call the batch file from my
> AUTOEXEC.BAT, and the variables would be set for good at startup.
> How do I do this on Windows 2000 and XP?
>
> (If you're wondering why I don't just type the environment
> variables into the System control panel, it's because they're
> set by a Microsoft Visual C++ compiler script, VCVARS32.BAT.
> You need to run this batch file in order to use the compiler
> from the command line; it does a lot of complex stuff and
> modifies your PATH and other variables accordingly. I don't
> want to have to keep running this over and over again, every
> time I pop open a Command Prompt.)
>
> Any ideas? Thanks for any help,
>
> - David Librik
>

Google