CD, CHDIR
suggest changeCD and CHDIR are the same command
Changes to a different directory, or displays the current directory. However, if a different drive letter is used, it does not switch to that different drive or volume.
Examples:
cd
Prints the current directory, e.g.
C:\Windows\System32
.cd C:\Program Files
No surrounding quotes are needed around paths with spaces.
cd \Program Files
cd Documents
cd %USERPROFILE%
cd /d C:\Program Files
Changes to the directory of the
C:
drive even ifC:
is not the current drive.C: & cd C:\Program Files.
Changes to the directory of the
C:
drive even ifC:
is not the current drive.cd ..
Changes to the parent directory. Does nothing if already in the root directory.
cd ..\..
Changes to the parent directory two levels up.
C: & cd C:\Windows\System32 & cd ..\..\Program Files
Uses
..
to navigate through the directory tree up and downcd \\myserver\folder
Does not work. Changing the directory directly to a network Universal Naming Convention (UNC) folder does not work. Keywords: UNC path.
subst A: \\myserver\folder && cd /d A:
Changes the directory to a server folder with the use of SUBST command, assuming drive letter A: is free.
pushd \\myserver\folder
Automatically creates a drive for the folder and changes to it. After you use POPD, the drive gets unassigned again.
cd C:\W*
Changes to
C:\Window
s, in a typical Windows setup. Thus, wildcards work. Useful for manual typing from the command line.cd C:\W*\*32
Changes to
C:\Windows\System32
, in a typical Windows setup.
Links:
$ 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.