首页 文章

'ls'未被识别为内部或外部命令,可操作程序或批处理文件

提问于
浏览
4

'ls'不被识别为内部或外部命令,可操作程序或批处理文件 . 当我尝试浏览文件夹的文件时出现此错误 .

  • cmd定期打开(不是管理员) .

  • 我最近为python下载了anaconda . 在安装过程中,有一段时间我允许添加一个不推荐的PATH . 'ls'以前工作得很好

这是路径

enter image description here

2 回答

  • 0

    我很确定 ls 命令适用于Linux,而不是Windows(我使用Windows,因为你引用了 cmd ,这是Windows操作系统的命令行) .

    您应该使用 dir ,这是Windows等效的 ls .

    Edit (since this post seems to be getting so many views :) ):

    您不能在 cmd 上使用 ls ,因为它不随 Windows 一起提供,但您可以在其他终端程序(例如GitBash)上使用它 . 注意,如果服务器基于 linuxFTP 正在 cmd 中使用, ls 可能适用于某些 FTP 服务器 .

    dirWindows 上类似于 ls . 要找出各种可用选项,只需执行 dir/? .

    如果你真的想使用 ls ,你可以安装第三方工具,以便在 Windows 上运行 unix 命令 . 这样的程序是 Microsoft Windows Subsystem for Linuxlink to docs) .

  • 16

    你可以使用dir而不是ls

    要么

    你也可以在windows中添加ubuntu bash 然后在windows中使用' ls ' .

    在Windows 10中添加ubuntu bash

    • 转到设置

    • 选择“更新和安全”

    • 在左侧选择'For developers'

    • 启用开发者模式我选择它

    • 现在打开cmd并输入bash,然后按 y 确认下载

    这将在Windows 10中安装ubuntu bash . 要使用它打开cmd并键入bash

    然后你可以使用 cmd 中的所有linux终端命令

    thisthis链接

相关问题