4.35 Operating System Interaction
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Operating System Interaction
          • shell/1
          • shell/2
          • getenv/2
          • setenv/2
          • unsetenv/1
          • setlocale/3
          • Windows-specific Operating System Interaction
          • Apple specific Operating System Interaction
          • Dealing with time and date
          • Controlling the swipl-win.exe console window
    • Packages
Availability:built-in
setenv(+Name, +Value)
Set an environment variable. Name and Value must be instantiated to atoms or integers. The environment variable will be passed to shell/[0-2] and can be requested using getenv/2. They also influence expand_file_name/2. Environment variables are shared between threads. Depending on the underlying C library, setenv/2 and unsetenv/1 may not be thread-safe and may cause memory leaks. Only changing the environment once and before starting threads is safe in all versions of SWI-Prolog.