Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Add-PathVariable

Add-PathVariable

pscx.dll

Synopsis

PSCX Cmdlet: Adds the specified paths to the end of the named, path-oriented environment variable.

Syntax

Add-PathVariable [-Value] [-Name] [-Prepend] [-Target] [<CommonParameters>]

Detailed Description

Adds the specified paths to the end of the named, path-oriented environment variable by taking the paths specified by the Value parameter and concatenating them into a semi-colon separated string. The paths can be prepended to the environment variable by using the -Prepend switch parameter.

Parameters

-Value <String[]>

The paths to concat together with semi-colon separators.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-Name <String>

The name of the environment variable to add to. Typically either Path (default), Lib, Include, etc.

Aliases

None

Required?

false

Position

named

Default value

Path

Accept pipeline input?

false

Accept wildcard characters?

false

-Prepend <SwitchParameter>

The specified paths will be prepended to the environment variable instead of appended.

Aliases

None

Required?

false

Position

named

Default value

False

Accept pipeline input?

false

Accept wildcard characters?

false

-Target <EnvironmentVariableTarget>

Specifies which target scope to modify. The valid values are Process (default), User or Machine. Using either the User or the Machine target scope will cause the new value to persist.

Aliases

None

Required?

false

Position

named

Default value

Process

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- EXAMPLE 1 --------------------------

Adds the specified paths to the end of current Lib environment variable setting (creating it if necessary) in the Process scope.

Add-PathVariable Lib C:\Lib, C:\ProjA\Lib

-------------------------- EXAMPLE 2 --------------------------

Adds the specified paths to the end of current Lib environment variable setting (creating it if necessary) in the User scope.

Add-PathVariable Lib C:\Lib, C:\ProjA\Lib -Target User

Push-EnvironmentBlock
Pop-EnvironmentBlock
Get-PathVariable
Set-PathVariable