Change the current directory with cmd

Use Windows with cmd scripts to navigate and change the current active directory and drive in the file system. Ether on laptops, desktops or on servers, it’s very convenient to list the folders and to navigate inside the folder structure. Indeed, with one command MS-DOS allows to change folder or drive.

Change the current directory or drive with MS-DOS commands

Indeed, to use the cd command line, use this example and adjust it to your needs. With cmd scripts, change the current directory to another and also change the current drive to copy or navigate in another disk or server on the network.

1. Change the current folder and move one level up

This simple script changes the current directory to go up by one level. Repeat it to go to the higher folder or drive in the Windows system.

cd ..

2. Change the current drive with cmd

Use the following script to change from one drive to another in cmd, for example, if the current drive is C:, to move to D:. To move the current position to a specific folder, use the full directory path or the relative path.

  • The full directory path, or absolute path, is the full path from the drive letter, for example C:\Folder\SubFolder or from a server name, like \\servername\folder\subfolder
  • The relative path the one depending to your current position. For example, if the current position is C:\Folder, then the relative path to the child is simply .\SubFolder
cd D:

3. Change the current active folder in cmd

If you are currently in C:\Folder and you need to access the sub folder, two options are available. The first one using the relative path, usable only from the subfolder parent, i.e., Folder.

cd SubFolder

4. Change the current folder using the absolute path

The second one using the absolute path, executable from any folder on the windows system.

cd C:\Folder\SubFolder

5. Go to the root folder or drive

To go to directly to the cmd root directory from any folder on the system.

cd \

This cmd tutorial explains how to change current the directory and drive inside the windows file system with the cd command line.

More on the cmd command lines

How to copy Windows 10 files using the command prompt ?