Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

setting environment variables i WIN200

21 views
Skip to first unread message

Morten Dolmer Christensen

unread,
Aug 25, 2001, 9:02:21 AM8/25/01
to
I would like to set an environment variable in WIN2000/NT using WSH.
In a command shell it would be like this "set
NLS_LANG=ENGLISH_AMERICA.WE8ISO8859P1", but I want to do it from a
VBS-script.

I found that there are a command to remove environment variables:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Environment("VOLATILE").Remove("NLS_LANG")

I can not find a method that adds og changes environment variables.


The new setting of the environment variable should apply to a program that
are to be executed from the same VBS-script; like this:

Return = wsh.Run("rwrun60.exe NLS_TEST.rep", 5, FALSE)

The new value of the environment variable do only have to apply to the
current session.

best regards
Morten D. Christensen


Torgeir Bakken

unread,
Aug 25, 2001, 1:24:00 PM8/25/01
to
Hi Morten

You was close :-)

This will set an env. var for the script and all it programs it calls (W9x/Me,
WNT/W2k), it will only apply to the
current session ("Process").


Set WshShell = CreateObject("WScript.Shell")
Set WshProcessEnv = WshShell.Environment("Process")

' Set your environment variable
WshProcessEnv("NLS_LANG") = "ENGLISH_AMERICA.WE8ISO8859P1"


Regards,
Torgeir

Morten Dolmer Christensen

unread,
Aug 25, 2001, 2:03:03 PM8/25/01
to
Dear Torgeir

Thank you very much for your answer, it solved the problem.

Tak skal du have.

regards
Morten


"Torgeir Bakken" <Torgeir.B...@hydro.com> wrote in message
news:3B87DF30...@hydro.com...

0 new messages