Environment

Set-EnvVar

Overview

Allows persistent environment variable creation and immediate update in the host session's env: PSDrive.

Cmdlet Attributes

Copy
Copied
CmdletBinding : []
Alias         : ['export']

Parameters

Name : System.String

The name of the environment variable to set.

Attributes

Copy
Copied
Parameter : [Mandatory = $true, Position = 0]

Value : System.String

The value of the environment variable to set.

Attributes

Copy
Copied
Parameter        : [Mandatory = $true, Position = 1, ValueFromPipeline = $true]
AllowNull        : []
AllowEmptyString : []

Scope : System.String

The scope of the environment variable to be set.

Default: 'USER'

Attributes

Copy
Copied
Parameter   : []
Alias       : ['s']
ValidateSet : ['USER', 'MACHINE']

NoPersist : System.Management.Automation.SwitchParameter

If this switch is specified, the environment variable update will only be reflected in the $env: PSDrive and will not be available once the PowerShell session has exited.

Attributes

Copy
Copied
Parameter : []
Alias     : ['np']

Output

Type: [ System.Boolean ]

Indicates if the environment variable was set successfully.

History

Author Date Version Release Notes
Anthony Maxwell 09/29/2023 1.0.0 - Initial release.