Function Entry: GETENV
← Prev | ↑ Chapter | Next → | Index | Symbols
Function Entry: GETENV
Name
getenv
Class
Function
Syntax
(getenv variable-name)
Arguments and Values
variable-name: string; the environment-variable name. Names must be spelled and cased exactly as stored in the system registry.
Description
Returns the value bound to the named environment variable. Returns nil if the variable is not defined.
Return Values
A string, or nil.
Side Effects
None.
Examples
- After ACAD is set to
/acad/support:(getenv "ACAD")returns"/acad/support". - For an undefined variable:
(getenv "NOSUCH")returns nil. (getenv "MaxArray")returns"10000"if the variable is set to that value.
Availability
- AutoCAD 2026: documented.
- BricsCAD V26: presumed compatible.
- Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.
clautolisp
On unix platforms clautolisp distinguishes a defined-but-empty
variable (returns "") from an undefined one (returns nil). On
ms-windows this distinction does not exist at the OS level: the Win32
environment cannot hold a variable with an empty value — setting one
to the empty string deletes it — so (getenv) returns nil there,
exactly as AutoCAD on Windows does.
Source Notes
- [getenv (AutoLISP 2026)](https://help.autodesk.com/cloudhelp/2026/ENU/AutoCAD-AutoLISP-Reference/files/GUID-0796D4FE-C07B-4DB6-9C01-9D772CAFA2C0.htm)
- Status: documented (Phase 3 body fill).