繁体   English   中英

为什么需要在cmd提示符下更改驱动器?

[英]Why do you need to change drives in cmd prompts?

在cmd提示下,如果您想从

c:\foo\

d:\bar\

您必须输入

d:

在可以之前先更换驱动器

cd d:\bar\

在Linux上,您不必这样做。 为什么cmd凭直觉使您必须这样做? 历史? 实施限制? 通过设计?

我明白那个

cd /d

模仿Linux行为,但是为什么Linux的行为不是默认行为? 据我所知

cd anotherDrive:\directory\

它只是什么都不做,所以这不像“ without / D”用法是为其他语义保留的。

每个驱动器有一个当前工作目录,您可以执行以下操作

> cd d:\some\long\path\     # Set the working directory of that other drive
> copy myFile.txt d:        # Copy the current file to that drive
> cd ..                     # Go elsewhere
> copy anotherFile.txt d:   # Copy another

我敢打赌,当您使用2个软盘驱动器时,这很方便。

我看不出有任何技术原因。 大概只是如何使用提示的设计选择。

作为PA。 提到如果您不喜欢这种行为,可以使用/d开关。

你不需要

刚刚阅读HELP CD

然后尝试

    CD /d d:\bar

CD默认行为仍然存在,以便与旧版本的DOS向后兼容,因为旧版本的DOS具有双磁盘托架,因此非常有用。

较新的命令(例如, pushd具有默认行为,以遵循驱动器和路径。

暂无
暂无

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

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