EnvironSet

Changes LOCAL Environment variables.

Syntax:

EnvironSet(name, value)

Parameters:

(s) name name of environment variable. (See Note 1).

(s) value desired value.

Returns:

(i) @TRUE Environment variable was modified.; @FALSE if unable to modify environment.

 

Use this function to change the LOCAL environment variables.

32-bit versions

32-bit versions of WIL will always pass the local environment to any programs they launch. In the 32-bit versions, the RunEnviron command is identical to the RunShell Command.

Note 1: DOS expects UPPERCASE environment variable names. Windows allows mixed upper and lowercase names. If you are using WIL with DOS, be sure to use uppercase names.

Note 2:
To alter the path for DOS programs, all that is required is a simple batch file, and the usual WIL Run command. Assuming the case where one wished to run "command.com" with the path "c:\special", a generic batch file as shown below will suffice, along with passing all the information required as parameters in the WIL Run command.

 

 DoPath.bat file listing
  SET PATH=%1
  ECHO %PATH%
  PAUSE
  %2 %3 %4 %5 %6 %7 %8 %9

 

 WIL Run Command
  Run("dopath.bat", "c:\special command.com")

 

Example:


;Note
;16-bit users should use the
; "Environment Manager Extender"
; instead of this function .
;
;NT Users note: Permanent changes may be made by
;using the registry functions to update the registry.
;
;Note that this function will not affect the environment for
; DOS or Console applications
;
;Note: Modifying the path does not allow assist WIL in
;locating the EXE file. The path WIL uses has already
;been pre-determined. However the child process (excel)
;will inhieret the PATH environment variable in this case.
EnvironSet("PATH","c:\Program Files\Tmp\")
RunEnviron("c:\Program Files\Tmp\abc.exe","",@NORMAL,@WAIT)
See Also:

Environment, EnvItemize, RunEnviron