Main Content

unsetenv

Remove environment variable

    Description

    example

    unsetenv(name) removes the operating system environment variable name. If name does not exist, then unsetenv has no effect.

    Examples

    collapse all

    Create environment variable myVar and check that it exists.

    setenv("myVar","myValue");
    isenv("myVar")
    ans = logical
       1
    
    

    Remove myVar and check that it no longer exists.

    unsetenv("myVar");
    isenv("myVar")
    ans = logical
       0
    
    

    Input Arguments

    collapse all

    Environment variable name, specified as a string scalar or character vector.

    Example: "PATH"

    Version History

    Introduced in R2022b

    See Also

    | | | | |