The GETENV subroutine gets the value of the specified environment variable.
Syntax
GETENV(env_var, env_value)
env_var is an INTENT(IN) scalar of type CHARACTER. It specifies the environment variable whose value is requested.
env_value is an INTENT(OUT) scalar of type CHARACTER. On return, it contains the value of the environment variable env_var.
If the specified environment variable does not exist, on return, env_value contains spaces.
If the length of env_value is not sufficient to hold the entire environment value, the leftmost characters are retained up to the length of the character variable.
Example
character(4096) :: env_value1 call getenv("PATH",env_value1) write(*,*) len_trim(env_value1),trim(env_value1)