powershell - 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 已经在我的别名列表中,我检查了这个。
解决方案
Powershell 5.1文档:New-Alias
备注 要创建新别名,请使用 Set-Alias 或 New-Alias。要更改别名,请使用 Set-Alias。要删除别名,请使用 Remove-Item。
所以在 Powershell 5.x 下你必须使用Remove-Item
. 如上评论所述,Remove-Alias
仅 PowerShell 6 支持。
检查this stackoverflow answer如何通过删除别名Remove-Item
。
推荐阅读
- ajax - Symfony 表单返回 CSRF 令牌对 AJAX 请求无效
- javascript - 如何添加自定义属性,如隐藏
- javascript - 表单控件:Pristine 属性未更新?
- jquery - 如何使用多个选择过滤 jQuery 中的结果,包括日期范围?
- python - BeautifulSoup4 没有找到所需的元素。问题是什么?
- docker - 使用 Ansible 为 Docker 映像添加新标签
- reactjs - React Laravel 项目 - 只有 URL 发生变化,但页面未呈现
- python-3.x - 熊猫,这是什么意思
- php - 创建唯一的 8 位数字
- python-3.x - 如何将变量传递给python selenium中的Css选择器