Home » How to Change Directory in CMD

How to Change Directory in CMD

You can use the following syntax in Command Prompt (CMD) to change the current directory:

cd path\to\directory

This particular example will change the current directory to the specified path.

Note: Ensure that the path you provide exists, otherwise you will receive an error.

The following example shows how to use this syntax in practice.

Example: Change Directory in CMD

Suppose that we want to change our current directory to the following path:

C:\Users\admin\Documents\cmd_script

We can type the following command to change the directory:

cd C:\Users\admin\Documents\cmd_script

The following screenshot shows how to use this syntax in practice:

Change a directory in cmd
Change a directory in cmd

We can see that the current directory has been changed to C:\Users\admin\Documents\cmd_script.

Suppose we want to navigate to a directory that is one level up from the current directory, you can use the following syntax:

cd ..

The following screenshot shows how to use this syntax in practice:

C:\Users\admin\Documents\cmd_script>cd ..

C:\Users\admin\Documents>

We can see that the current directory has been changed to the parent directory.

Conclusion

We can use the cd command followed by the path to navigate to any directory on your system.

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.