控制台窗口主机,总是使用引号?

时间:2012-02-29 02:41:58

标签: console cmd quotes

控制台窗口主机或conhost.exe允许您将文件或文件夹拖到cmd.exe窗口,而不是键入路径。

如果路径包含任何空格,则它用双引号括起来,例如

"C:\Program Files"

问题

&符号

如果您碰巧有&拖动路径,则会失败

cd C:\foo&bar
The system cannot find the path specified.
'bar' is not recognized as an internal or external command, operable program
or batch file.

如果你碰巧在Windows上使用Bash,那么没有空格的任何路径都会 失败。

$ cd C:\Windows\System32
sh: cd: C:WindowsSystem32: No such file or directory


有没有办法让conhost始终将引号应用于拖动的文件?

1 个答案:

答案 0 :(得分:1)

另一种方法是使用 Tab 来完成路径。

我必须编辑我的~/.inputrc才能添加此内容。

"\t": complete-filename

来源:gnu.org/software/bash/manual/bashref

相关问题