我试图编译一些java(学习java目前),这样做,我需要改变命令提示符的目录。

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

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

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

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


当前回答

您可以在CD命令的命令提示符上使用帮助 通过写入CD /? 如图所示

其他回答

为了移动到D盘在windows中使用,

C:\Users\Balaji>d:

为了移动到E盘使用,

C:\Users\Balaji>e:

同样将适用于其他驱动器。

简短的回答

从C开始的正确方法:\…\Adminto D:\Docs\Java驱动器,是以下命令:

cd /d d:\Docs\Java

更多的细节

如果你在D:\驱动器上的某个随机位置,并且你想要到驱动器的根目录,你可以使用这个命令:

cd d:\

如果你在D:\驱动器上的某个随机位置,并且你想要到驱动器上的特定文件夹,你可以使用这个命令:

cd d:\Docs\Java

如果你在不同的驱动器上,并且你想去到你的D:\驱动器的根目录,你可以使用这个命令:

cd /d d:\

如果你在不同的驱动器上,并且你想要到D:驱动器上的特定文件夹,你可以使用这个命令:

cd /d d:\Docs\Java

如果你在不同的驱动器上,并且你想要转到你的D:驱动器的最后一个打开文件夹,你可以使用这个命令:

cd /d d:

作为cd /d d:的简写,你也可以使用这个命令:

d:

长话短说:

虽然它确实是cd driveletter:\以前(例如cd d:\),

在Windows 10中,它是drivelletter:\ only(例如d:)。

您要切换到的目录在另一个驱动器上,您需要使用以下命令切换到该驱动器:

C:\...\Admin> d:

然后您可以CD到您想要的目录。

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

D:\Docs\Java>

正如@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.