Powershell不能使用remove-alias

时间:2019-06-24 04:09:25

标签: powershell

当我输入PowerShell:

Remove-Alias -Name someAlias

此错误显示:

Remove-Alias : The term 'Remove-Alias' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Remove-Alias -Name someAlias
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Remove-Alias:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

注意:someAlias已经在我的别名列表中,我选中了它。

1 个答案:

答案 0 :(得分:3)

Powershell 5.1 New-Alias中的docu

  

注意   要创建新别名,请使用Set-Alias或New-Alias。要更改别名,请使用Set-Alias。要删除别名,请使用Remove-Item。

因此在Powershell 5.x下,您必须使用Remove-Item。在上述注释中,Remove-Alias仅在PowerShell 6中受支持。

对此stackoverflow answer进行检查,了解如何通过Remove-Item删除别名。

相关问题