繁体   English   中英

ls -a 命令在我的 VS Code 终端上不起作用

[英]ls -a command is not working on my VS Code terminal

ls : Cannot find path 'C:\Users\LENOVO\learngit\~a' because it does not exist.
+ ls ~a
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\LENOVO\learngit\~a:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
 
PS C:\Users\LENOVO\learngit> ls -a
Get-ChildItem : Parameter cannot be processed because the parameter name 'a' is ambiguous. Possible matches include: -Attributes -Directory -File 
-Hidden -ReadOnly -System.
+ ls -a
+    ~~
    + CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.GetChildItemCommand

PowerShell 中的lsGet-ChildItem的别名。 这就是为什么您会看到以下错误

Get-ChildItem :无法处理参数,因为参数名称“a”不明确

-a选项在Linux ls ,与 PowerShell 的ls无关。 要使用Get-ChildItem列出所有文件,请使用-Force

Get-ChildItem -Force
ls -Fo

如果你想使用 Linux ls命令,那么你需要在像 bash 这样的 Unix shell 中运行它。 如果您在 Windows 上有 git,那么 bash 和其他 GNU 工具应该已经可以使用了

如果 GNU 工具可用,那么当然您也可以从 PowerShell 运行 GNU ls ,但您必须明确指定.exe扩展名或删除ls别名,但不建议使用这些工具

ls.exe
Remove-Alias ls # Don't do this
ls -a

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM