CmdID

CmdID / PowerShell / Cmdlets / Clear

Clear-Variable

Deletes the value of a variable. PowerShell reference

From the PowerShell reference 8 parameters Alias clv

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Deletes the value of a variable. The Clear-Variable cmdlet deletes the data stored in a variable, but it does not delete the variable. As a result, the value of the variable is NULL (empty). If the variable has a specified data or object type, this cmdlet preserves the type of the object stored in the variable.

Clear-Variable [-Name] <String[]> [-Include <String[]>] [-Exclude <String[]>] [-Force] [-PassThru] [-Scope <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Remove the value of global variables that begin with a search string

Clear-Variable my* -Scope GlobalIdentify

Clear a variable in a child scope but not the parent scope

$a = 3 &{ Clear-Variable a } $aIdentify

Delete the value of the specified variable

Clear-Variable -Name "Processes"Identify

Its page in the reference: Clear-Variable.

Parameters

8 in the PowerShell reference
-ExcludeSpecifies an array of items that this cmdlet omits in the operation. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted.
-ForceAllows the cmdlet to clear a variable even if it is read-only. Even using the Force parameter, the cmdlet cannot clear constants.
-IncludeSpecifies an array of items that this cmdlet includes in the operation. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted.
-NameSpecifies the name of the variable to be cleared. Wildcards are permitted. This parameter is required, but the parameter name Name is optional.
-PassThruReturns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
-ScopeSpecifies the scope in which this alias is valid. The acceptable values for this parameter are: - Global - Local - Script You can also use a number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent). Local is the default. For more information, see about_Scopes.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.