Windows Environment variables in ModelBuilder

Idea created by curtvprice Champion on Jul 15, 2020
    New
    Score10
    • mattdobson

    It sure would be great to access Windows environment variables in ModelBuilder as builtin model variables. For example %COMPUTERNAME% %USERNAME% or user defined ones set in the Windows Control Panel or in a startup script. I realize one can do this with Calculate Value calling os.environ["COMPUTERNAME"], but this would be easier.

     

    Way back in the 20th century, in ArcInfo Workstation AML, we could access windows env variables like AML variables with %COMPUTERNAME%. In that environment, if a windows environment variable conflicted with an AML variable the model variable would always take precedence to avoid confusion. I think that would be a good way to do it in ModelBuilder too.

     

    A very common use case for me is constructing path names, so for example %TEMP%\%USERNAME%_%t%