Environment.SetItem
 
 
 

Environment.SetItem

Introduced

v4.0

Description

Sets the specified system environment variable. If the specified environment variable doesn't exist, one is created.

Note: This method should be used by Python scripters who need to set an environment variable through scripting. Since the Environment.Item property is not settable for Python users, this method is a workaround. For more information (and instructions for setting up Python COM support for XSIUtils), see Environment.Item.

C# Syntax

Environment.SetItem( String in_bstrName, String newVal );

Scripting Syntax

Environment.SetItem( Name, Value );

Parameters

Parameter Type Description
Name String The name of the system environment variable.
Value String New value for system environment variable,

Examples

1. VBScript Example

' This example illustrates how to create and set a system environment variable,
call XSIUtils.Environment.SetItem("MYVAR",  1 )
call logmessage( "MYVAR=" & XSIUtils.Environment("MYVAR" ) )

2. JScript Example

// This example illustrates how to create and set a system environment variable,
XSIUtils.Environment.SetItem("MYVAR",  1 );
LogMessage( "MYVAR=" + XSIUtils.Environment("MYVAR" ) );

3. Python Example

# This example illustrates how to create and set a system environment variable,
XSIUtils.Environment.SetItem("MYVAR",  1 )
Application.LogMessage( "MYVAR=" + XSIUtils.Environment.Item("MYVAR" ) )