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

DOS - SETLOCAL and comparison

Status
Not open for further replies.

Opium

MIS
Oct 18, 2002
5
US
Does anybody know if there is anything in VBScript which supports the SETLOCAL and ENDLOCAL commands from DOS? Or a workaround it?

Any feedback would help a great deal. Thanks! -tams
 
Remind me what SETLOCAL and ENDLOCAL do in order to help; plizzzz. Water is not bad as long as it stays out human body ;-)
 
As I recall SETLOCAL/ENDLOCAL bracketed an area in a batch file in which environment variables could be temporarily set to different values from the "global" ones with the same name.

Any programs that this instance of the command shell runs in between these brackets would see the temporary environment variables instead of the real or "global" values.

I can't see the value of this in a WSH script, and even if the script was doing something like executing external programs via WShell.Run I don't think it'd have any effect.

Don't these programs normally run under a new instance of the command shell? Guess I can't be sure of that.

Then again, maybe I'm remembering wrong and SETLOCAL/ENDLOCAL is for something else.
 
If it's what your saying, Dilettante, then I know a method to set ENV variables that are only aviable to the running vbs and its children. Use "
Code:
Set WshEnvironnement= WshShell.Environment("PROCESS")
". Then use it this way :
Code:
path = WshEnvironnement.item("PATH")
WshEnvironnement.item("MY_ENV_VAR")="myEnvVar"
Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top