cd Command in Windows

cd Command in Windows

To do everything you need on Windows quickly, CMD (Windows Command Prompt) is what you use. But what if you want to change the directory in CMD? This is where the CD command comes to help you. Using cd Command in Windows and changing the directory in cmd is what you will learn in this article.

Since the CD command is for changing the directory, you can use it to change the directory command. After buying Windows VPS, the current working directory in CMD in Windows can be changed easily by the CD command in Windows. Then, you can open other considered directories on your target folders on Windows.

What is cd command and when is used?

As a Windows user, you are used to working with the command-line terminal to run different commands to do tasks and manage your system. The cd command is the abbreviation for the ‘’chdir’’ command. It is used to change the current working directory to a considered one. So, you need to know what your current working directory is first. In Windows, you can check your current working directory by running the ‘’cwd’’ command (Current Working Directory) to view and change it.

Join us with this article to review the function of cd command in Windows.

Using cd Command in Windows to change directory in cmd

The directory/folder you are working in is the current working directory when you interact with your command prompt. To change directory on Windows, being familiar with the Command prompt is essential. Firstly, type ‘’cmd’’ in the Windows search bar. In this way, the Command prompt will be opened, and you can select ‘’Command Prompt’’ from the search results. Then, you are ready to change the desired directories.

change directory in cmd using command prompt

Check the Current Working Directory

Since the default prompt in the command prompt displays the current working directory, you do not need to check it when you are on your Windows command prompt. However, using the cd command in Windows (with no argument) enables you to check the current working directory.

cd

The cwd is not required to be printed since it will be displayed by the prompt.

Change the Current Working Directory (CWD)

The cmd command lets you change your current working directory to your preferred directory/system drive and generally different paths. To do this, you can use 3 different methods that will be explained in detail in the following of this guide.

1. Change the CWD to a Directory of Current Drive

Let’s say you want to switch to a different directory on the same disk from where you are currently working. The “cd” command must be used in this situation, along with either the absolute path or the relative path to the directory you wish to move to.

Note: Make sure the path leads to an existing directory before giving the destination path or directory. Additionally, the path to that particular directory may be fixed or relative. The path must be relative to the present working directory if you’re using the relative path.

However, to change the same drive’s directory, run:

cd [path]

2. Change the CWD to Another Drive’s Directory:

Again. let’s say you want to switch the system’s present working directory to an already-existing directory on a different drive. In that situation, you can use the cd command in Windows with the /D option to move to a specific directory by specifying the path.

So, to change the current working directory to a different directory located on a different drive, run:

cd /d [path]

Also, you can use the drive letter followed by the colon sign (DRIVE_LETTER and COLON) to change the path to your considered drive directly. To use this additional way, run:

(Drive_Letter):

3. Change the CWD Using the Drag-and-Drop:

You can easily switch to the desired directory if it is already open in File Explorer or is located on your desktop. Drag and place the folder into the window, type cd, followed by a space, and then hit Enter. Finally, you will see that the directory you are moving to is shown in the command line.

Since using the drag-and-drop method is not easy, the two above ways (Command Prompt methods) to change directories are the most used and popular.

How to View Directory Contents

Anytime and everywhere you feel you need to check which directory to navigate to next, you can see the contents of your current directory. To do this, simply run the following command in your command line:

dir

How to Observe Directory Changes

Another usage of cd command in Windows is when you want to be more efficient with your directory changes. To do this, do one of the below methods you prefer:

1. Type cd followed by the first few letters of the directory you want and press Tab to autocomplete the directory name.

2. Type cd followed by the first letter of the directory and press Tab several times to bring up the proper directory.

How to Set cd command to ‘’always be in set’’ Mode

It is the opposite of query mode. To do this, you must include the /D setting. This extends the command so that it changes the current drive in addition to changing a drive’s current directory and requires the command to always be in set mode.

To change the directory to whatever the current directory on drive D, run:

cd /d d:

It also changes the current drive to drive D.

To change the command interpreter process’ current drive otherwise, run the drive letter and a colon:

d:

The path must be absolute, have a drive qualifier, and a drive letter.

It is because you want to go to your considered folder straightly, without having gone to the directory which that folder is in it.

Conclusion

In this article, you learned how to use cd command in Windows to change directory in cmd. Now, you know all about the cd command in Windows and the way you can use it to change from one directory to your preferred one. When you learn to use Windows terminal commands, you will be able to do complex tasks just by running a few commands easily. This tutorial simply explained the different options that specify the way the cd command works. So, you must know how it works with them and the way the absolute and relative paths work.

The cd command in Windows won’t change the existing directory if you provide it with no parameters or arguments consisting solely of a drive letter and a colon. It gives the current directory of the current drive of the command interpreter process if you don’t provide any arguments. Also, it will tell the current directory of that drive’s command interpreter process if you only supply it with a drive letter and a colon as an argument.

Leave a Reply

Your email address will not be published. Required fields are marked.