Environment Variables
Aus Wiki-WebPerfect
Version vom 5. Mai 2020, 09:28 Uhr von Admin (Diskussion | Beiträge)
Inhaltsverzeichnis
Get environment variable
Get using "System.Environment" (Scope = System)
[Environment]::GetEnvironmentVariable('<VariableName>', 'Machine')
Set environment variable
The System.Environment class provides GetEnvironmentVariable and SetEnvironmentVariable methods that allow you to specify the scope of the variable.
- User = User
- System = Machine
Set using "System.Environment" (Scope = System)
[Environment]::SetEnvironmentVariable("<VariableName>", "<VariableValue>", 'Machine')
More informations: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7