Skip to content

Add-EnvironmentPath

SYNOPSIS

Add a path to the PATH environment variable.

SYNTAX

__AllParameterSets

Add-EnvironmentPath [[-Scope] <string>] [-Path] <string[]> [-Force] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

Add a path to the PATH environment variable. This command will normalize the path separators.

EXAMPLES

EXAMPLE 1

Add-EnvironmentPath -Scope CurrentUser -Path 'C:\Program Files\Git\cmd'

Add the path 'C:\Program Files\Git\cmd' to the PATH environment variable for the current user.

EXAMPLE 2

Add-EnvironmentPath -Scope AllUsers -Path 'C:\Program Files\Git\cmd'

Add the path 'C:\Program Files\Git\cmd' to the PATH environment variable for all users.

EXAMPLE 3

Add-EnvironmentPath -Scope CurrentUser -Path 'C:\Program Files\Git\cmd', 'C:\Program Files\Git\bin'

Add the paths 'C:\Program Files\Git\cmd' and 'C:\Program Files\Git\bin' to the PATH environment variable for the current user.

EXAMPLE 4

Add-EnvironmentPath -Scope CurrentUser -Path 'C:\Program Files\Git\cmd', 'C:\Program Files\Git\bin' -Force

Add the paths 'C:\Program Files\Git\cmd' and 'C:\Program Files\Git\bin' to the PATH environment variable for the current user. Any invalid paths will be removed.

EXAMPLE 5

'C:\Program Files\Git\cmd', 'C:\Program Files\Git\bin' | Add-EnvironmentPath -Scope CurrentUser

Add the paths 'C:\Program Files\Git\cmd' and 'C:\Program Files\Git\bin' to the PATH environment variable for the current user.

PARAMETERS

-Force

Remove any invalid paths.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Path

The path to add to the environment variable.

Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- FullName
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Scope

The scope of the environment variable.

Type: System.String
DefaultValue: CurrentUser
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String[]

{{ Fill in the Description }}

OUTPUTS

NOTES

{{ Fill in the related links here }}