command-line - 命令提示符不会将目录更改到另一个驱动器

标签 command-line cmd directory command-line-interface command-prompt

我正在尝试编译一些java(当前正在学习java),为此我需要更改命令提示符的目录。

C:\...\Admin> cd D:\Docs\Java
C:\...\Admin> cd
C:\...\Admin

它不会更改目录。我再次尝试使用引号:

C:\...\Admin> cd "D:\Docs\Java"
C:\...\Admin>

同样,它不会更改目录。我做错了什么?

最佳答案

@nasreddine已回答或者您可以使用 /d

cd /d d:\Docs\Java

有关 cd 命令的更多帮助,请使用:

C:\Documents and Settings\kenny>help cd

Displays the name of or changes the current directory.

CHDIR [/D] [drive:][path] CHDIR [..] CD [/D] [drive:][path] CD [..]

.. Specifies that you want to change to the parent directory.

Type CD drive: to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory.

Use the /D switch to change current drive in addition to changing current directory for a drive.

If Command Extensions are enabled CHDIR changes as follows:

The current directory string is converted to use the same case as the on disk names. So CD C:\TEMP would actually set the current directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, so it is possible to CD into a subdirectory name that contains a space without surrounding the name with quotes. For example:

cd \winnt\profiles\username\programs\start menu

is the same as:

cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.

关于command-line - 命令提示符不会将目录更改到另一个驱动器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11065421/

相关文章:

java - 我如何执行命令行参数 "java -Djava.security.manager GetProps"但使用 NetBeans

dll - 在 64 位机器上检查 32 位程序时,我可以获得正确的任务列表/m 的 DLL 模块列表吗?

php - 使用cmd保存带有DATE的mySQL文件

C - fopen 有时有效,有时无效

c# - 在执行 File.Move 之前确保文件夹存在的最简单方法是什么?

r - 将一个文件夹(包含图像)拆分为两个并将图像移动到新文件夹

ios - NSBundle 的 pathForDirectory 方法?

linux - 什么 linux 命令行工具从字符串的开头提取所有字符子字符串?

c++ - 是否有任何跨平台库可以通过 C++ 使用 shell(Windows 中的 cmd)?

linux - 如何在命令行中使用 aspell