I\'m trying to compile some java (learning java currently), and to do so I need to change command-prompt\'s directory (using javac).
C:\\...\\Admin> cd D:
If you want to change from current working directory to another directory then in the command prompt you need to type the name of the drive you need to change to, followed by : symbol. example: assume that you want to change to D-drive and you are in C-drive currently, then type D: and hit Enter.
On the other hand if you wish to change directory within same working directory then use cd(change directory) command followed by directory name. example: assuming you wish to change to new folder then type: cd "new folder" and hit enter.
Tips to use CMD: Windows command line are not case sensitive. When working with a file or directory with a space, surround it in quotes. For example, My Documents would be "My Documents". When a file or directory is deleted in the command line, it is not moved into the Recycle bin. If you need help with any of command type /? after the command. For example, dir /? would give the options available for the dir command.
You can change directory using this command like : currently if you current working directoris c:\ drive the if you want to go to your D:\ drive then type this command
cd /d D:\
now your current working directory is D:\ drive so you want go to Java directory under Docs so type below command :
cd Docs\Java
note : d stands for drive
Use drive letter d for changing to D drive like:
C:\> d:
When changing drives, you just need to type the drive letter, like d: (don't use the backslash, like d:\; it doesn't work).
You only use cd when moving between directories within the same drive.
As @nasreddine answered or you can use /d
cd /d d:\Docs\Java
For more help on the cd
command use:
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.
you can use help on command prompt on cd command by writing this command cd /? as shown in this figure