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

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

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

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

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


当前回答

如果你想从C: Drive跳转到任何驱动器,只需在Anaconda中输入冒号(E:),然后回车,Anaconda会在E:Drive中将你重定向。

现在获取文件夹路径,使用cd .\<<Folder_Path>>,然后回车。

我把截图放上去供大家参考:

其他回答

长话短说:

虽然它确实是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.

可以使用此命令修改目录 比如:当前如果你当前的工作目录是c:\ drive the 如果你想去你的D:\驱动器,然后键入这个命令

cd /d D:\

现在你的当前工作目录是D:\ drive,所以你想去Docs下的Java目录,所以输入下面的命令:

cd Docs\Java

注:d为drive(驱动器)

如果您想从当前的工作目录更改到另一个目录,那么在命令提示符中,您需要键入您需要更改的驱动器的名称,后面跟着:符号。 例如:假设你想要更改到d盘,而你目前在c盘,然后输入 D:然后按Enter键。

另一方面,如果您希望更改同一工作目录下的目录,则使用cd(更改目录)命令后跟目录名。 示例:假设您希望更改到新文件夹,然后键入:CD“新文件夹”并按enter。

使用CMD的技巧: Windows命令行不区分大小写。 当处理带有空格的文件或目录时,请用引号将其括起来。例如,My Documents应该是“My Documents”。 在命令行中删除文件或目录时,不会将其移动到回收站。 如果您需要任何命令类型/?命令后。例如,dir /?将为dir命令提供可用选项。