CD 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 if C:
is not the current drive.
C: & cd C:\\Program Files.
Changes to the directory of the C:
drive even if C:
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 down
cd \\\\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: