How To Change Directory in CMD (Command Prompt)
To change the directory in CMD, we use the
CD command. Alternatively, you can use the
chdir command, which works the same way.
CD path CHDIR path
- If you run the CD command without any parameters, the current working directory is displayed.
- If you want to change the drive, for example, from
D:drive, you need to use the
- To list files in the Windows command prompt, use the dir command.
Change to the data directory. Since we don't specify the absolute path (full path), the data directory is a subfolder inside the current working folder.
Change the directory to
cd "C:\Program Files"
Change to the parent directory of the current folder:
Change the drive. For example, I am currently working in the
C: drive, if I want to change to
D: drive, I have to use
cd /d E:
The following command changes the directory to the root of the current drive: