Paul
Fri Aug 13 16:34:57 CDT 2004
Torgeir,
Thank You very much.
Paul
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:OjQ3ONXgEHA.1344@TK2MSFTNGP11.phx.gbl...
> Paul Ilacqua wrote:
>
> > How can I set several environment variables with a VB script.
> > These will be system Environment variables.
> Hi
>
> Create/set/change environment variables permanent (WNT/W2k/WXP
> from VBScript:
>
> 'Example for setting a environment variable with name "ASSET"
> and value "1234"
>
> '--------------------8<----------------------
> Set oShell = CreateObject("WScript.Shell")
>
> ' makes environment settings permanent and for all users
> ' Use "USER" instead of "SYSTEM" to set it for current
> ' user only, or "PROCESS" to set it for current process only
> Set oWshSystemEnv = oShell.Environment("SYSTEM")
>
> ' Set your environment variable
> oWshSystemEnv("ASSET") = "1234"
> '--------------------8<----------------------
>
>
> For Win9x/WinME, only "PROCESS" is available.
>
>
> For SYSTEM and USER, you might need a logoff/logon to make the
> changes take affect.
>
>
> WSH 5.6 documentation (local help file) can be downloaded
> from here if you haven't got it already:
>
>
http://msdn.microsoft.com/downloads/list/webdev.asp
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
>
http://www.microsoft.com/technet/scriptcenter/default.mspx