GetSystemEnvironment

摘要

Gets the specified system environment variable value, such as "TEMP".

讨论

When using GetSystemEnvironment to retrieve the "TEMP" environment variable's value, GetSystemEnvironment will cycle through "TEMP", "TMP" and "MW_TMPDIR" environment variables and return the first value it finds.

语法

GetSystemEnvironment (environment)
参数说明数据类型
environment

The name of the system environment variable.

String
返回值
数据类型说明
String

Returns the value of the specified system environment variable as a string.

代码示例

GetSystemEnvironment example

Return the specified system environment variable value.

import arcpy
from arcpy import env

# Get the system TEMP variable value
# 
environment = arcpy.GetSystemEnvironment("TEMP")

# Set the scratchWorkspace environment variable value
#   to the value returned from the system environment variable TEMP
env.scratchWorkspace = environment

相关主题


7/10/2012