Add-EnvironmentPath¶
SYNOPSIS¶
Add a path to the PATH environment variable.
SYNTAX¶
Add-EnvironmentPath [[-Scope] <String>] [-Path] <String[]> [-Force] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
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¶
-Scope¶
The scope of the environment variable.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: CurrentUser
Accept pipeline input: False
Accept wildcard characters: False
-Path¶
The path to add to the environment variable.
Type: String[]
Parameter Sets: (All)
Aliases: FullName
Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-Force¶
Remove any invalid paths.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.