en-US/EnvironmentVariableCmdlet.dll-Help.xml
<?xml version="1.0" encoding="utf-8"?> <helpItems schema="maml" xmlns="http://msh"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-EnvironmentVariable</command:name> <command:verb>Add</command:verb> <command:noun>EnvironmentVariable</command:noun> <maml:description> <maml:para>Append a new value to a current environment variable</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Add-EnvironmentVariable takes the current value of an environment variable and adds a new value, separated by the `path separator` character. By default, new values are added to the end of the existing variable value, but values can be prepended to the value with the `-Prepend` parameter. Depending on the scope of the variable, you may need to run `Add-EnvironmentVariable` in an elevated session. Specifically, when creating a variable in the `machine` scope, administrator privileges are required because the Windows registry location hklm:\System\CurrentControlSet\Control\Session Manager\Environment is updated.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-EnvironmentVariable</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable to which a new value will be added.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"> <maml:name>Value</maml:name> <maml:Description> <maml:para>The value to be added to the variable.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>Create a variable if one does not exist. The provided value will be used and no separator will be added.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:Description> <maml:para>Pass the newly modified variable object back</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Prepend</maml:name> <maml:Description> <maml:para>Using `-Prepend` will place the new value at the beginning of the existing variable.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Process</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">User</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Machine</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Separator</maml:name> <maml:Description> <maml:para>When combining the values of the existing variable with the new value, a separator is added between the two values. The default value for `-Separator` is platform dependent. On Windows systems, the default value for `-Separator` is `;`. On Linux and MacOS systems, the default value for `-Separator` is `:`.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>[System.IO.Path.PathSeparator]</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The variable is not modified.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>Create a variable if one does not exist. The provided value will be used and no separator will be added.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable to which a new value will be added.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:Description> <maml:para>Pass the newly modified variable object back</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Prepend</maml:name> <maml:Description> <maml:para>Using `-Prepend` will place the new value at the beginning of the existing variable.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Separator</maml:name> <maml:Description> <maml:para>When combining the values of the existing variable with the new value, a separator is added between the two values. The default value for `-Separator` is platform dependent. On Windows systems, the default value for `-Separator` is `;`. On Linux and MacOS systems, the default value for `-Separator` is `:`.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>[System.IO.Path.PathSeparator]</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"> <maml:name>Value</maml:name> <maml:Description> <maml:para>The value to be added to the variable.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The variable is not modified.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.PowerShell.Commands.EnvironmentVariable</maml:name> </dev:type> <maml:description> <maml:para>When `-PassThru` is used a `Microsoft.PowerShell.Commands.EnvironmentVariable` object is returned.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>See also Get-EnvironmentVariable, New-EnvironmentVariable, Remove-EnvironmentVariable, Set-EnvironmentVariable</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS> new-environmentvariable -name test -value value1 PS> Add-EnvironmentVariable -name test -value value2 PS> $env:test value1:value2</dev:code> <dev:remarks> <maml:para>Create an environment variable with `value1` and add `value2` to it. Note that the two values are separated by `:` which is the PathSeparator on non-Windows systems.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>PS> Add-EnvironmentVariable -name test2 -value value2 Add-EnvironmentVariable : test2 At line:1 char:1 + Add-EnvironmentVariable -name test2 -value value2 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (test2:String) [Add-EnvironmentVariable], ItemNotFoundException + FullyQualifiedErrorId : AddEnvironmentVariableCommand,Microsoft.PowerShell.Commands.AddEnvironmentVariableCommand PS> Add-EnvironmentVariable -name test2 -value value2 -force PS> $env:test2 value2</dev:code> <dev:remarks> <maml:para>Note how `-force` is required to create a non-existent environment variable</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>PS> new-environmentvariable -name test -value /tmp PS> Add-EnvironmentVariable -Name test -Value /usr/local/bin -PassThru Name Value Scope ---- ----- ----- test /tmp:/usr/local/bin Process</dev:code> <dev:remarks> <maml:para>Using `-PassThru` allows you to retrieve the value directly.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks /> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-EnvironmentVariable</command:name> <command:verb>Get</command:verb> <command:noun>EnvironmentVariable</command:noun> <maml:description> <maml:para>Retrieve an environment variable.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Every process has an `environment block` which contains the set of environment variables and their values. When a new process is created, the process inherits the environment variables of its parent process. The `Get-EnvironmentVariable` cmdlet allows you to retrieve those variables rather than using the `$env:PATH` syntax or `Get-Item` cmdlet. You can retrieve environment variables via wildcards, and optionally, you can retrieve only the value of the environment variable.</maml:para> <maml:para>Variable Scope</maml:para> <maml:para>While variables created in the process do not persist after the process has exited, some variables may persist after the process exits. On Windows systems, variables may also be created in a specific `scope`, which allows variables to set for all users of a system, or only the user.</maml:para> <maml:para>* `Process` * The environment variable is stored or retrieved from the environment block associated with the current process.</maml:para> <maml:para>* `User` * The environment variable is stored or retrieved from the HKEY_CURRENT_USER\Environment key in the Windows operating system registry. This value may be used on Windows systems only.</maml:para> <maml:para>* `Machine` * The environment variable is stored or retrieved from the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment key in the Windows operating system registry. This value may be used on Windows systems only.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-EnvironmentVariable</maml:name> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="True (ByPropertyName, ByValue)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable. Wildcards are supported. Parameter names are found in a case-insensitive manner.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Process</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">User</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Machine</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ValueOnly</maml:name> <maml:Description> <maml:para>Return only the value of the environment variable.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="True (ByPropertyName, ByValue)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable. Wildcards are supported. Parameter names are found in a case-insensitive manner.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ValueOnly</maml:name> <maml:Description> <maml:para>Return only the value of the environment variable.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.PowerShell.Commands.EnvironmentVariable</maml:name> </dev:type> <maml:description> <maml:para>The EnvironmentVariable object has the following properties:</maml:para> <maml:para>|Property Type | Property Name| |---|---| |String|Name| |EnvironmentVariableTarget|Scope| |String|Value|</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>See also Add-EnvironmentVariable, New-EnvironmentVariable, Remove-EnvironmentVariable, Set-EnvironmentVariable</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS> get-environmentvariable Name Value ---- ----- __CF_USER_TEXT_ENCODING 0x1F5:0x0:0x0 Apple_PubSub_Socket_Render /private/tmp/com.apple.launchd.6zSQW25C9C/Render HOME /Users/jimtru LANG en_US.UTF-8 LOGNAME jimtru PATH /usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/microsoft/powershell/6:/usr/bin:/bin:/sb… PSModulePath /Users/jimtru/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/usr/local/microsoft/powershe… PWD /Users/jimtru SECURITYSESSIONID 186a8 SHELL /bin/bash SHLVL 0 SSH_AUTH_SOCK /private/tmp/com.apple.launchd.X8qlPHU7Gm/Listeners TERM xterm-256color TERM_PROGRAM Apple_Terminal TERM_PROGRAM_VERSION 421.2 TERM_SESSION_ID DC63F98A-CA2E-4118-A76F-B273C39CB174 TMPDIR /var/folders/px/05lybgxx6mlf60qjssxyxbrm0000gn/T/ USER jimtru XPC_FLAGS 0x0 XPC_SERVICE_NAME 0</dev:code> <dev:remarks> <maml:para>This retrieves all the environment variables available in the current process.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>PS> get-environmentvariable T* Name Value Scope ---- ----- ----- TERM xterm-256color Process TERM_PROGRAM Apple_Terminal Process TERM_PROGRAM_VERSION 421.2 Process TERM_SESSION_ID DC63F98A-CA2E-4118-A76F-B273C39CB174 Process TMPDIR /var/folders/px/05lybgxx6mlf60qjssxyxbrm0000gn/T/ Process</dev:code> <dev:remarks> <maml:para>This retrieves all environment variables whose name has 'T' as the first letter.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>PS> get-environmentvariable PSModulePath Name Value ---- ----- PSModulePath /Users/jimtru/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/usr/local/microsoft/powershell/6/Modules:/…</dev:code> <dev:remarks> <maml:para>retrieve the `PSModulePath` environment variable</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 4 --------------------------</maml:title> <dev:code>PS> Get-EnvironmentVariable psmodulePath -ValueOnly /Users/jimtru/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/usr/local/microsoft/powershell/6/Modules:/Users/jimtru/bin/module:/Users/jimtru/bin/module:/Users/jimtru/bin/module:/Users/jimtru/bin/module</dev:code> <dev:remarks> <maml:para>retrieve only the value of the `PSModulePath` environment variable.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks /> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-EnvironmentVariable</command:name> <command:verb>New</command:verb> <command:noun>EnvironmentVariable</command:noun> <maml:description> <maml:para>Create a new environment variable</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Create a new environment variable with the supplied value. If this variable already exists, an error will be produced, unless the `-Force` parameter is provided. Depending on the scope of the variable, you may need to run `New-EnvironmentVariable` in an elevated session. Specifically, when creating a variable in the `machine` scope, administrator privileges are required because the Windows registry location hklm:\System\CurrentControlSet\Control\Session Manager\Environment is updated.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-EnvironmentVariable</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"> <maml:name>Value</maml:name> <maml:Description> <maml:para>The value of the environment variable</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>If the variable already exists, an error is returned. Using `-Force` will set the variable to the new value.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:Description> <maml:para>Return the newly created variable object.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Process</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">User</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Machine</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The environment variable is not created.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>If the variable already exists, an error is returned. Using `-Force` will set the variable to the new value.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:Description> <maml:para>Return the newly created variable object.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"> <maml:name>Value</maml:name> <maml:Description> <maml:para>The value of the environment variable</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The environment variable is not created.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.PowerShell.Commands.EnvironmentVariable</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>See also Add-EnvironmentVariable, New-EnvironmentVariable, Remove-EnvironmentVariable, Set-EnvironmentVariable</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS> New-EnvironmentVariable -name Name1 -Value Value1 PS> $env:Name1 Value1</dev:code> <dev:remarks> <maml:para>Create a new environment variable</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>PS> New-EnvironmentVariable -Name Name1 -Value Value2 New-EnvironmentVariable : Name1 At line:1 char:1 + New-EnvironmentVariable -Name Name1 -Value Value2 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-EnvironmentVariable], IOException + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.NewEnvironmentVariableCommand PS> New-EnvironmentVariable -Name Name1 -Value Value3 -Force PS> $env:Name1 Value3</dev:code> <dev:remarks> <maml:para>An error is produced when using `New-EnvironmentVariable` when the variable already exists.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>PS> New-EnvironmentVariable -Name Name2 -Value Value2 -Pass Name Value Scope ---- ----- ----- Name2 Value2 Process PS> $env:Name2 Value2</dev:code> <dev:remarks> <maml:para>Use `-PassThru` to return the newly created variable</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>http://go.microsoft.com/fwlink/?LinkID=113285</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113285</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-EnvironmentVariable</command:name> <command:verb>Remove</command:verb> <command:noun>EnvironmentVariable</command:noun> <maml:description> <maml:para>Remove an environment variable.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Remove an environment variable from a scope. Depending on the scope of the variable, you may need to run `Add-EnvironmentVariable` in an elevated session. Specifically, when creating a variable in the `machine` scope, administrator privileges are required because the Windows registry location hklm:\System\CurrentControlSet\Control\Session Manager\Environment is updated</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-EnvironmentVariable</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name(s) of the variable(s) to remove. Wildcards are supported.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Process</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">User</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Machine</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The variables are not removed.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name(s) of the variable(s) to remove. Wildcards are supported.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The variables are not removed.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>See also Add-EnvironmentVariable, New-EnvironmentVariable, Get-EnvironmentVariable, Set-EnvironmentVariable</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS> $env:Variable1 = "value1" PS> $env:Variable2 = "value2" PS> $env:Variable3 = "value3" PS> $env:Variable1 value1 PS> Remove-EnvironmentVariable -Name Variable1 PS> $env:Variable1 PS></dev:code> <dev:remarks> <maml:para>Remove a variable</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>PS> $env:Variable2 = "value2" PS> $env:Variable3 = "value3" PS> Remove-EnvironmentVariable -Name Variable2,Variable3 PS> $env:Variable2 PS> $env:Variable3</dev:code> <dev:remarks> <maml:para>Remove a collection of variables</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>PS> $env:Variable1 = "Value1" PS> $env:Variable2 = "Value2" PS> $env:Variable3 = "Value3" PS> get-childitem env:variable* Name Value ---- ----- Variable2 Value2 Variable3 Value3 Variable1 Value1 PS> Remove-EnvironmentVariable -Name Variable* PS> get-childitem env:variable* PS></dev:code> <dev:remarks> <maml:para>Remove a number of variables via a `wildcard`</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113285</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-EnvironmentVariable</command:name> <command:verb>Set</command:verb> <command:noun>EnvironmentVariable</command:noun> <maml:description> <maml:para>Set the value of an environment variable</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Set the value of an environment variable. If the environment variable does not exist, an error will be produced. You can use the `-Force` parameter to override this behavior to create and set the variable. Depending on the scope of the variable, you may need to run `Set-EnvironmentVariable` in an elevated session. Specifically, when creating a variable in the `machine` scope, administrator privileges are required because the Windows registry location hklm:\System\CurrentControlSet\Control\Session Manager\Environment is update</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-EnvironmentVariable</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"> <maml:name>Value</maml:name> <maml:Description> <maml:para>The value to set</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>If the environment variable does not exist, an error will be produced. Using `-Force` will create the variable if it does not exist.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:Description> <maml:para>Return the newly set variable.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Process</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">User</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Machine</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The variable value is not changed.</maml:para> </maml:Description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:Description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:Description> <maml:para>If the environment variable does not exist, an error will be produced. Using `-Force` will create the variable if it does not exist.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="0" aliases="none"> <maml:name>Name</maml:name> <maml:Description> <maml:para>The name of the variable</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:Description> <maml:para>Return the newly set variable.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Scope</maml:name> <maml:Description> <maml:para>The scope of the variable. On Windows systems, three values are accepted: `Process`, `User`, and `Machine`. On Non-Windows systems, only `Process` is permitted. Attempts to use `User` or `Machine` on non-Windows systems will produce a parameter binding error.</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">EnvironmentVariableTarget</command:parameterValue> <dev:type> <maml:name>EnvironmentVariableTarget</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Process</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="1" aliases="none"> <maml:name>Value</maml:name> <maml:Description> <maml:para>The value to set</maml:para> </maml:Description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:Description> <maml:para>Shows what would happen if the cmdlet runs. The variable value is not changed.</maml:para> </maml:Description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.PowerShell.Commands.EnvironmentVariable</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para>See also Add-EnvironmentVariable, New-EnvironmentVariable, Remove-EnvironmentVariable, Get-EnvironmentVariable</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS> $env:name1 1 PS> Set-EnvironmentVariable -Name name1 -value 2 PS> $env:name1 2</dev:code> <dev:remarks> <maml:para>Change the value of environment variable name1 from 1 to 2</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>PS> Set-EnvironmentVariable -name name5 -value 5 Set-EnvironmentVariable : name5 At line:1 char:1 + Set-EnvironmentVariable -name name5 -value 5 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:String) [Set-EnvironmentVariable], ItemNotFoundException + FullyQualifiedErrorId : SessionStateException,Microsoft.PowerShell.Commands.SetEnvironmentVariableCommand PS> Set-EnvironmentVariable -name name5 -value 5 -force PS> $env:name5 5</dev:code> <dev:remarks> <maml:para>Use `-Force` to create and set an environment variable that does not exist</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>PS> Set-EnvironmentVariable -name name5 -value 10 -pass Name Value Scope ---- ----- ----- name5 10 Process</dev:code> <dev:remarks> <maml:para>Use `-PassThru` to return the newly set variable.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>http://go.microsoft.com/fwlink/?LinkID=113285</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems> |