Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Use Other Methods to Set Environment Variables

All Operating Systems

From within a program: Call the SETENVQQ routine to set environment variables. For example:

USE IFPORT
LOGICAL success
success = SETENVQQ("FORT9=C:\mydir\test.dat")

Depending on your operating system, there are additional ways to set environment variables.

Linux*

Within the Bourne*/Bourne* Again shell (sh/bash), or the Korn shell (ksh), use the export command and assignment command to set an environment variable:

export FORT9
FORT9=/usr/users/smith/test.dat

To remove the association of an environment variable and its value within the Bourne*, Korn shell, or bash shells, use the unset command:

unset FORT9

Within the C shell (csh), use the setenv command to set an environment variable:

setenv FORT9 /usr/users/smith/test.dat

To remove the association of an environment variable and its value within the C shell, use the unsetenv command.

unsetenv FORT9

Windows*

Environment variables in a command prompt session can be set using the SET command. Changes here will affect programs run from that command prompt only. For example:

set FORT9=C:\mydir\test.dat

To remove an environment variable, omit the value. For example:

set FORT9=

To display the current value, use the ECHO command and enclose the environment variable name in the percent signs as shown below:

echo %FORT9%

To display the values of all variables whose names begin with a string, use SET and omit the equal sign as shown below:

set FORT

In Microsoft Visual Studio you can specify environment variables that will be set when a program is run. In the project properties, edit the Configuration Properties > Debugging > Environment property and set the field to a series of name=value pairs separated by semicolons. For example:

FORT9=C:\mydir\test.dat;FOR_FORCE_STACK_TRACE=TRUE

A default set of environment variables is established per user and at the system level. These can be specified through Control Panel > System > Advanced System Settings > Environment Variables.

NOTE:

Changing system-wide environment variables affects command line builds (those done without IDE involvement), but not builds done through the IDE. IDE builds are managed in the IDE using Tools > Options. An exception to this is an IDE build (devenv) done from the command line that specifies the useenv option. In this case, the IDE uses the PATH, INCLUDE, and LIB environment variables defined for that command line.