精華區beta mud_sanc 關於我們 聯絡資訊
os.getenv (varname) 說明:回傳當前程序的環境變數varname的值,若變數未定義則回傳nil。 範例:print(os.getenv("USERDOMAIN")) 輸出:RDEV    print(os.getenv("SystemRoot")) 輸出:C:\WINDOWS    print(os.getenv("Os2LibPath")) 輸出:nil    print(os.getenv("ProgramFiles" )) 輸出:C:\Program Files    print(os.getenv("APPDATA" )) 輸出:C:\Documents and Settings\baiyun\Application Data    print(os.getenv("ALLUSERSPROFILE" )) 輸出:C:\Documents and Settings\All Users    print(os.getenv("CommonProgramFiles" )) 輸出:C:\Program Files\Common Files    print(os.getenv("COMPUTERNAME" )) 輸出:BAIYUN    print(os.getenv("USERNAME")) 輸出:baiyun    print(os.getenv("USERPROFILE" )) 輸出: C:\Documents and Settings\baiyun    print(os.getenv("ComSpec")) 輸出:C:\WINDOWS\system32\cmd.exe    print(os.getenv("LOGONSERVER" )) 輸出:http://www.cnblogs.com/whiteyun/admin/file://rdev1/    print(os.getenv("NUMBER_OF_PROCESSORS" )) 輸出:2    print(os.getenv("OS")) 輸出:Windows_NT    print(os.getenv("PATHEXT" )) 輸出:.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py;.pyw;.wlua    print(os.getenv("PROCESSOR_ARCHITECTURE" )) 輸出:x86    print(os.getenv("PROCESSOR_IDENTIFIER" )) 輸出:x86 Family 15 Model 43 Stepping 1, AuthenticAMD    print(os.getenv("PROCESSOR_LEVEL" )) 輸出:15    print(os.getenv("PROCESSOR_REVISION" )) 輸出:2b01    print(os.getenv("USERDOMAIN")) 輸出:HMML-F165899659    print(os.getenv("SystemRoot" )) 輸出:C:\WINDOWS    print(os.getenv("TEMP")) 輸出:\LOCALS~1\Temp