有没有办法列出 dired 中的驱动器号?

发布于 2024-09-17 09:04:05 字数 163 浏览 10 评论 0原文

在 Windows 上,我如何打开显示所有驱动器号的可怕缓冲区。当您执行 Cx d 时,您应该始终提供一个目录,但我想从驱动器号级别开始,而不是特定驱动器的根目录。

如果不存在标准解决方案,您有一个(dired 的扩展吗?)?或有关该主题的文章的链接?

On windows, how could I open a dired buffer showing all drive letters. When you do C-x d you should always provide a directory, but I want to start at the drive letters level instead of a root directory of a particular drive.

If no standard solution exists, do you have one (an extension to dired ?) ? or links to articles on the subject ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

〗斷ホ乔殘χμё〖 2024-09-24 09:04:06

在 dired 中,您只能查看目录,并且由于不存在包含您的驱动器号的目录,因此您看不到它们的列表。

为此,您必须为 dired 编写一个 emacs-lisp 扩展。

AFAIK 没有现有的扩展,但是,调用 wmic 可以为您提供驱动器号和卷名称的列表,这将是一个很好的起点。

wmic 命令:

wmic logicaldisk get caption,drivetype,providername,volumename

从 emacs-lisp 调用它并以字符串形式获取结果。

(let (sh-output volumes)
  (setq sh-output (shell-command-to-string "wmic LogicalDisk get Caption,DriveType,ProviderName,VolumeName"))
)

将为您提供卷列表(驱动器类型:3 = HDD,4 = 网络映射,5 = 光纤。)

但是,您无法通过此输出来识别缓冲区,因此您需要创建一个主要的用于浏览 Windows 卷的模式,它将显示此列表并绑定 RET 以查找当前行上的驱动器号并在其根目录下执行 dired。

如果您只想列出驱动器号...

(let (sh-output volumes)
  (setq sh-output (shell-command-to-string "wmic LogicalDisk get Caption"))
)

会这样做。

In dired you can only view directories, and since no directory exists which contains your drive letters, you can't see a list of them.

To do this you'd have to write an emacs-lisp extension for dired.

AFAIK there's no existing extension, however, a call to wmic can give you a listing of drive letters and volume names, which would be a good starting point.

The wmic command:

wmic logicaldisk get caption,drivetype,providername,volumename

Calling it from emacs-lisp and getting the result as a string.

(let (sh-output volumes)
  (setq sh-output (shell-command-to-string "wmic LogicalDisk get Caption,DriveType,ProviderName,VolumeName"))
)

Will give you a list of the volumes (DriveType : 3 = HDD, 4 = Network Mapping, 5 = Optical.)

However, you can't get dired to recognize a buffer with this output, so you'd need to create a major mode for browsing windows volumes, which would show this listing and bind RET to find the drive letter on the current line and do a dired at it's root.

If you just want the drive letters listed...

(let (sh-output volumes)
  (setq sh-output (shell-command-to-string "wmic LogicalDisk get Caption"))
)

Will do that.

情感失落者 2024-09-24 09:04:06

Dired+ 有你想要的。

命令 diredp-w32-drives 打开 Windows 驱动器的列表/菜单。使用 RETmouse-2 在其中一个驱动器上打开 Dired。本地驱动器来自选项 diredp-w32-local-drives,您可以自定义该选项。

如果您在访问某个驱动器(例如 C:\)时在 Dired 中点击 ^,那么您将进入所有驱动器的相同列表/菜单。

Dired+ has what you want.

Command diredp-w32-drives opens a list/menu of the Windows drives. Use RET or mouse-2 to open Dired on one of the drives. The local drives come from option diredp-w32-local-drives, which you can customize.

If you hit ^ in Dired when visiting one of your drives (e.g. C:\), then you get to the same list/menu of all drives.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文