zoukankan      html  css  js  c++  java
  • Remove-Variable in Windows command line

    Deletes a variable and its value.

    Syntax

    PowerShell
    Remove-Variable
          [-Name] <String[]>
          [-Include <String[]>]
          [-Exclude <String[]>]
          [-Force]
          [-Scope <String>]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]

    Description

    The Remove-Variable cmdlet deletes a variable and its value from the scope in which it is defined, such as the current session. You cannot use this cmdlet to delete variables that are set as constants or those that are owned by the system.

    Examples

    Example 1: Remove a variable

    PowerShell
    Remove-Variable Smp

    This command deletes the $Smp variable.

    Parameters

    -Confirm

    Prompts you for confirmation before running the cmdlet.

    TABLE 1
    Type: SwitchParameter
    Aliases: cf
    Position: Named
    Default value: False
    Accept pipeline input: False
    Accept wildcard characters: False
    -Exclude

    Specifies an array of items that this cmdlet omits from the operation. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted.

    TABLE 2
    Type: String[]
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: True
    -Force

    Indicates that the cmdlet removes a variable even if it is read-only. Even using the Force parameter, the cmdlet cannot remove a constant.

    TABLE 3
    Type: SwitchParameter
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    -Include

    Specifies an array of items that this cmdlet deletes in the operation. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as s*. Wildcards are permitted.

    TABLE 4
    Type: String[]
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: True
    -Name

    Specifies the name of the variable to be removed. The parameter name (Name) is optional. Wildcards are permitted

    TABLE 5
    Type: String[]
    Position: 0
    Default value: None
    Accept pipeline input: True
    Accept wildcard characters: True
    -Scope

    Gets only the variables in the specified scope. The acceptable values for this parameter are:

    • Global
    • Local
    • Script
    • 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.

    TABLE 6
    Type: String
    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.

    TABLE 7
    Type: SwitchParameter
    Aliases: wi
    Position: Named
    Default value: False
    Accept pipeline input: False
    Accept wildcard characters: False

    Inputs

    PSVariable

    You can pipe a variable object to Remove-Variable.

    Outputs

    None

    This cmdlet does not return any output.

    Notes

    • Changes affect only the current scope, such as a session. To delete a variable from all sessions, add a Remove-Variable command to your PowerShell profile.

    • You can also refer to Remove-Variable by its built-in alias, rv. For more information, see about_Aliases.

  • 相关阅读:
    .vue 文件中怎么引用全局的sass 样式
    git 本地仓库同时推送到多个远程仓库
    markdown文件生成html页面
    查看IPA安装包文件信息工具
    如何给iOS安装包IPA注入一个动态库文件?
    一年级语文上册读拼音写汉字,聪明的家长已收藏,偷偷给孩子练习
    关于直接下载第三方IPA应用分发平台之蒲公英的研究
    如何给iOS安装包IPA添加时间锁功能?
    关于几种获取iOS设备UDID典型方式的技术探讨
    针对五款IPA文件安装工具的深度评测
  • 原文地址:https://www.cnblogs.com/kungfupanda/p/13599734.html
Copyright © 2011-2022 走看看