Action
Sets the value of the specified environment variable.
Syntax
SYS_SetEnv (sName, sValue)
Variable
|
Description
|
sName
|
The name of the environment variable to set. STRING.
|
sValue
|
The new value of the environment variable. STRING.
|
Notes
If
sName does not exist,
SYS_SetEnv creates it. An exception is raised if the system is out of environment space.
SYS_SetEnv persists only as long as the current session of
Silk Test Classic is open. The environment variables in Control Panel System settings are kept in the registry, so if you want to modify them with
Silk Test Classic, use:
SYS_SetRegistryValue(HKEY_LOCAL_MACHINE\
"SYSTEM\CurrentControlSet\Control\Session Manager\Environment",
"Path", "<the path you want to set>"
Windows Platforms
SYS_SetEnv is executed by the Agent process, not the
Silk Test Classic process.
To affect the host process, use the function with the hHost notation or machine handle operator. For more information about the machine handle operator and hHost, see
Machine handle operator.
Example
STRING sPath
sPath = SYS_GetEnv ("PATH")
Print (sPath)
// adds new directory to the PATH variable
sPath += "c:\newdir"
SYS_SetEnv ("PATH", sPath)
sPath = SYS_GetEnv ("PATH")
Print (sPath)