当我在 Powershell 中输入 dir 时,我想看到彩色的文件名。所以,我从这里将Set-ChildItemColor函数添加到我的配置文件中。我还在配置文件的末尾添加了这一行来覆盖 dir 别名:
Set-Alias dir Get-ChildItemColor
Run Code Online (Sandbox Code Playgroud)
现在,当我打开 Powershell 时,出现此错误:
Set-Alias : The AllScope option cannot be removed from the alias 'dir'.
At C:\Users\joe\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:82
char:10
+ Set-Alias <<<< dir Get-ChildItemColor
+ CategoryInfo : WriteError: (dir:String) [Set-Alias], SessionStateUna
uthorizedAccessException
+ FullyQualifiedErrorId : AliasAllScopeOptionCannotBeRemoved,Microsoft.PowerShe
ll.Commands.SetAliasCommand
Run Code Online (Sandbox Code Playgroud)
这是什么AllScope?如何删除该选项以获得彩色目录?