Skip to main content

GetSystemEnvironment

Resumen

Gets a specified system environment variable value, such as TEMP.

Debate

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

Sintaxis

GetSystemEnvironment(environment)

El parámetro Explicación Tipo de datos

environment

The name of the system environment variable.

String

Valor de retorno

Tipo de datos Explicación

String

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

Muestra de código

GetSystemEnvironment example

Return the specified system environment variable value.

import arcpy

# Set the scratchWorkspace environment to the value returned
# from the system environment variable TEMP.
arcpy.env.scratchWorkspace = arcpy.GetSystemEnvironment("TEMP")