如何强制 Windows cmd 选项卡完成以在目录名称中添加尾部斜杠

发布于 2024-11-02 19:09:47 字数 90 浏览 3 评论 0原文

在极少数情况下,我必须使用 Windows 命令提示符而不是 bash,这让我抓狂,制表符补全不会在目录名称末尾添加斜杠。是否有我可以运行的设置或脚本来强制完全完成?

On the rare occasion that I have to use a windows command prompt rather than bash, it drives me nuts that tab completion doesn't add a slash to the end of directory names. Is there a setting or script that I can run to force the full completion?

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

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

发布评论

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

评论(3

剑心龙吟 2024-11-09 19:09:48

如今的答案是 PowerShell。它是 Windows 命令行的超集。它有许多 Linux 命令。它具有基于对象的管道,并且可以从命令行完全访问 .NET 框架。

当使用 tab 扩展目录名称时,它会添加一个尾部斜杠。

POwerShell

The answer these days is PowerShell. It is superset of the windows command line. It has many of the Linux commands. It has an object-based pipeline and has full access to the .NET framework from the command line.

And it adds a trailing slash when using tab to expand a directory name.

POwerShell

沫雨熙 2024-11-09 19:09:48

不,没有这样的设置。您最好的选择是通过 cygwin 使用 bash,但我希望您已经了解这一点。

No there is no such setting. Your best bet is to use bash through cygwin but I expect you already knew that bit.

眉目亦如画i 2024-11-09 19:09:48

这是一个相当古老的线程,但我认为它可能对其他人仍然有帮助。

我在 Windows 中找不到一个参数来完成这个任务,但我找到了一个名为 PyCmd 的可执行文件(GNU,具有可用的 Pyton 源代码),它是对常规 CMD 控制台的改进(根据我和我的工作习惯)。

它可以通过双击来启动,它会使用 cmd.exe 启动一个常规控制台,并将其自身加载到内存中,以允许进行许多命令行编辑功能,其中包括我以前在 Unix Korn Shell 下使用的相同 TAB 补全行为(包括类似 Emacs 的键),目录后面带有斜杠或反斜杠。

您可以在以下位置找到它:
https://sourceforge.net/projects/pycmd/

最后一个版本是 2017 年 12 月的快照 (但对我来说稳定,与 2013 0.9 稳定版本相比,无法遇到任何重大问题),位于:
https://sourceforge.net/projects/pycmd/files/pycmd/snapshots/< /a>

您还可以从现有控制台(从 CMD.EXE)启动它,它会启动一个包含所有编辑功能的子 shell。您可以通过 exit 或空行上的 ^D 退出此子 shell。

请注意,我已经在“Hyper”等替代控制台(MIT 许可证,位于 https://hyper.is/< /a> 和 https://github.com/zeit/hyper),相比之下我更喜欢Windows 默认控制台,并且与它完美配合 也。我认为可以公平地假设它适用于 ConEmu 等其他控制台,但我没有用它们进行测试。

这个答案可能有点超出了最初的问题,但是——我希望——仍然可以为像我这样喜欢在 Unix Korn shell 下获得相同命令行行为的人提供一些帮助(可能是Linux bash,我不知道)。

为所有人提供一个漂亮的命令行界面!

通用汽车

this is quite an old thread but I thought it might still be helpful for others.

I could not find a parameter in Windows to do the trick but I found a executable (GNU, with the Pyton source available) named PyCmd which is an improvement (according to my and my work habits) to regular CMD console.

It can be launched by double click it and it starts a regular console with cmd.exe and it loads itself in the memory to allow a lot of command line editing goodies, among them the same TAB completion behaviour I used to have under Unix Korn Shell (including the Emacs-like keys) with the trailing slashes or back-slaches for directories.

You can find it at:
https://sourceforge.net/projects/pycmd/

The last version is a December 2017 snapshot (but stable for me, could not meet any major trouble compared to the 2013 0.9 stable release), at:
https://sourceforge.net/projects/pycmd/files/pycmd/snapshots/

You can also launch it from an existing console, from CMD.EXE and it starts a sub shell with all its editing goodies. You exit this sub-shell by exit or ^D on an empty line.

Note that I have tested it to under an alternative console like "Hyper" (MIT License, at https://hyper.is/ and https://github.com/zeit/hyper), which I prefer compared to Windows default console, and it works perfectly with it too. I think it's fair to assume that it will work well for other consoles like ConEmu or others, but I did not test it with them.

This answer goes perhaps a little far beyond the original question but -- I hope -- still can provide some help to people like me who like to get the same kind of command-line behaviour as they used to have under Unix Korn shell (possibly Linux bash, I don't know).

Have a nice command line interface to all!

GM

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