Skip to content

Env_SetString

Sets value of specified environment variable. The value is written to the registry: HKLM\System\CurrentControlSet\Control\Session Manager\Environment for system variables, and HKCU\Environment for user variables. A value that contains % is stored as an expandable string.

Programs that are already running don’t see the new value.

Env_SetString(sName, sValue, sType) As Boolean

Environment variable name

Environment variable value

Environment variable type: ‘System’ or ‘User’. Any other value, including ‘Process’, sets a system variable. In computer jobs, ‘User’ sets the variable for the account that runs the job.

Boolean, TRUE if function completed successfully.

If bStatus Then bStatus = Env_SetString("TEST", "C:\MyFiles", "SYSTEM")

Scripting Guidelines

Env_GetString Constants Package Property Variables