Set-EnvironmentVariable
Set-EnvironmentVariable
Set-EnvironmentVariable
SYNOPSIS
:choco-info: NOTE
Administrative Access Required when
-Scope 'Machine'.
DO NOT USE. Not part of the public API. UseInstall-ChocolateyEnvironmentVariable
instead.
SYNTAX
Set-EnvironmentVariable [-Name] <String> [[-Value] <String>] [[-Scope] <EnvironmentVariableTarget>]
[-IgnoredArguments <Object[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Saves an environment variable.
EXAMPLES
Example 1
PS C:\> Set-EnvironmentVariable -Name MyApplicationPath -Value C:\test -Scope Machine
Sets the MyApplicationPath
environment variable to C:\test
at the system level.
PARAMETERS
-IgnoredArguments
Allows splatting with arguments that do not apply. Do not use directly.
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Name
The name of the environment variable to set.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Scope
The scope to set the environment variable at.
Type: EnvironmentVariableTarget
Parameter Sets: (All)
Aliases:
Accepted values: Process, User, Machine
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Value
The value to set the named environment variable to.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
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.
INPUTS
OUTPUTS
NOTES
This command will assert UAC/Admin privileges on the machine if
-Scope 'Machine'
.