- How to Change Directory in CMD On Windows 10 Via Command Line0
- Part 1. What is cd (Change Directory) command?
- Part 2. How to Change Directory in CMD on Windows 10?
- Part 3. How to Change Drive and Directory in CMD with Single Command?
- Tips for changing directories in windows command line
- Change directory
- Change to a directory with spaces in the name
- Change drive and directory with single command
- Tips for changing directories in windows command prompt
- Use Pushd and Popd commands:
- How To Change Directory In CMD (MS-DOS and PowerShell)?
- cd Command Syntax
- cd Command Help
- Change Directory
- Using Tab To Complete Directory Name
- Change Multiple Level/Directories
- Change To Directory Name with Spaces
- Change To Upper/Parent Directory
- Change To Two Level Upper/Parent Directory
- Change To Sibling Directory
- Change To Root Directory
- Print/Display Current Working Directory
- Change Drive
- Change Drive and Directory
- Change Directory By Saving Current Path
- Change Directory To The Saved Path
- How to change Directory in Command Prompt on Windows 10
- How to change Directory in CMD
- 1] Using DIR and CD commands
- 2] Using Drag and Drop
- 3] Using the Tab key
- Related Posts
- How to uninstall a program using Command Prompt in Windows 10
- How to remove virus from USB Flash Drive using Command Prompt or Batch File in Windows 10
- Perform Arithmetic operations in Command Prompt on Windows 10
- [email protected]
How to Change Directory in CMD On Windows 10 Via Command Line0
Command prompt is the basic tool which can be used for many purpose like changing date, time, repairing some other issues. Command prompt is also called as cmd or cmd.exe i.e. after the name of execution file. The first prototype of command prompt was launched in Windows NT. It was created by Therese Stowell for basic control purpose of the PC. But it can also be used as a method of how to change drive in cmd.
Part 1. What is cd (Change Directory) command?
cd or Change Directory is the command which is the answer for how to change directory in command prompt. This command is used for changing the folder. In simpler terms it is a navigation command. The command «CD\» can take the user to the top of the directory tree i.e. in the C: drive. As the command prompt is not case sensitive so writing the command as «CD» or «cd» is more or less same. The command «cd\» or «CD\» will prompt the user to the root drive i.e. «C:» drive.
If the user wants to go to a specific folder via «CD» command then he or she should write the name of that folder after «cd» with a backslash i.e. «\». If the user wants to reach the folder named as «System32» in the Windows folder of C: drive then put the command like this «cd\windows\system32\» and press «Enter» from the keyboard.
It will take the use to «System32» folder. The user can also trace back to one folder back by «cd..» command. Just put «cd..» in the command line and press «Enter» from the keyboard.
Part 2. How to Change Directory in CMD on Windows 10?
Command prompt is one of the most used tools of Windows operating system. The process of command prompt change directory is not tough hence it is a mystery to most people. The steps for changing directories through the command line is as mentioned as below
Restarting the Windows Explorer is the easiest fix to solve the problem of the taskbar. Usually, Windows explorer resets itself if the taskbar is not working correctly, but if it does not then follow these simple steps to make it
1. First open Start and type in «Command Prompt» and search for it.
2. Make a right click on it after finding «Command Prompt» and then select «Run as administrator» from the drop down menu.
3. Click on «Yes» on the popped up User Account dialog.
4. To get the names of all the directories available on the PC type in «dir» command in the command line and press «Enter» from the keyboard
5. Within the directory list select the folder which is desired to be reached. Then type the name of the folder after command «cd» with backslash i.e. «\» behind the folder’s name.
6. After reaching the desired directory user can again use the «dir» command to see the contents of the directory i.e. files and folders present in it
7. User can change the directory by same «cd» command. Just type command «cd» before the name of the directory and press «Enter» form the keyboard
8. To start fresh i.e. to return back to the root directory use «cd/» command. Just type the said in the command line and press «Enter» from the keyboard.
Part 3. How to Change Drive and Directory in CMD with Single Command?
The basic cd command does not work if you are trying to change to a directory that is located on a different drive. Say you are in C:\users\cmdadmin\ directory and want to change to E:\docs directory. If you run ‘cd e:\docs’ you won’t get any error but you would still be in the same folder. In this case you can use /d option with cd command.
Note: To change the directory and the drive at the same time, first, we need to know what directories are available on the PC. To get the information type «dir» in the command line and press «Enter» from the keyboard. It will list all the directory names in the command window.
This command changes to the drive E: and also changes the directory to E:\docs.
If the command line above didn’t work for you, you can use the pushd command instead. Usually, the «pushd» command is used for merging the «cd» command with «D:» command. Pushd can remember all the previous directories you traversed as long as you change the directory using pushd instead of cd command. Using popd you can go back to all the previously visited folders in the reverse order.
It is done as given below:
«C: Temp>pushd D:\A\B» and press «Enter» from the keyboard
Where «A» is the directory and «B» is the sub-folder in the directory.
To come back to the root directory «popd» command is used just as below
«D:\A\B>popd» and press «Enter» from the keyboard.
With all this the confusion around «how to navigate in CMD?» is cleared. Except for switching directories and drives via command prompt, there are other problems like forgetting the password, which makes people suffer a lot. But with the use of a simple tool named Windows Password Key , one can easily deal with problems related to a lost password of WINDOWS 10 PC.
Tips for changing directories in windows command line
In Windows command prompt, we can change the directory using the command cd . Both cd and chdir refer to the same command. Syntax of this command is explained below with some examples.
Change directory
When we launch command prompt, the default directory it opens with is C:\Documents and Settings\logind. This is in Windows XP. In Windows 7 command prompt opens up with the directory C:\Users\loginid. Now let’s say you want to traverse to the directory C:\Windows\System32. The command for this is given below.
Change to a directory with spaces in the name
In Windows, we can have spaces in the directory names. cd command can interpret the space correctly. So we do not need to enclose quotes around the directory name, as with most of other windows commands. An example is shown below.
Change drive and directory with single command
The basic cd command does not work if you are trying to change to a directory that is located on a different drive. Say you are in C:\users\cmdadmin\ directory and want to change to E:\docs directory. If you run ‘cd e:\docs‘ you won’t get any error but you would still be in the same folder. Only when you switch the drive by running the command ‘E:’ you will move to the folder e:\docs. You can avoid this by using /d option with cd command.
This command changes to the drive E: and also changes the directory to E:\docs.
Tips for changing directories in windows command prompt
If you frequently work with windows command line, then the below tips would help you in easily changing the directories in command line.
Use Pushd and Popd commands:
Pushd command is similar to cd but it also saves the current directory path. So if you want go back to the directory where you have come from, you can just use popd command. It will take you to the last directory you were working in.
Pushd can remember all the previous directories you traversed as long as you change the directory using pushd instead of cd command. Using popd you can go back to all the previously visited folders in the reverse order. See the below example.
How To Change Directory In CMD (MS-DOS and PowerShell)?
cmd or cmd.exe or MS-DOS is a command-line tool used in Windows operating systems. One of the most basic operations for the command line is changing the directory. We can change the current working directory with the cd command. It may seem very basic and easy but a changing directory with the cd command provides a lot of different use cases like the change to a parent directory, change the drive, change to the root directory. In this tutorial, we will learn all of them.
cd Command Syntax
cd command has very simple syntax where we provide the path. There is also a drive part but it is used very rarely and optionally. We can also use chdir command like cd command which is the short form of chdir .
- DRIVE is optional and specifies the drive or partition like C: , D: we can also use lowercase like c: , d: . DRIVE is generally not used.
- PATH is the most important part where the directory names, . and .. are used to specify the path.
cd Command Help
As cd is a very simple command it has also very little helpful information for complete usage. We can print help information with /? like below.
Change Directory
We will start with a simple usage where we will provide the directory we want to change. The given directory is a child directory of the current or current working directory. In this example, we will change to the directory named Users , ismail , Desktop in a row.
Using Tab To Complete Directory Name
MS-DOS provides tab shortcuts to complete directory. If we do not know the whole directory name or it is too long to type we can use TAB key to list available directories. The completion will be done according to the provided directory name. For example, if we typed U and press TAB the directories like User , Users , Use will be listed. If we do not type any directory name all currently existing directories will be enumerated alphabetically.
Change Multiple Level/Directories
In the previous example, we have changed the directories one by one with multiple cd commands. We can also specify multiple directories in a single cd command. In this example, we will change to the Users , ismail , Desktop .
Change To Directory Name with Spaces
Directory names can be upper case, lower case, and provide some special characters like space. While navigating between directories with spaces we have to take care of the directory name. In order to prevent errors, we can use a double quote for the directory name with spaces or for the whole path like below. For example, in order to change the directory to the Program Files we should use «Program Files» like below.
Change To Upper/Parent Directory
In order to change one level upper or parent directory typing, the whole path is not feasible. We can use .. double dot which simply references one level upper or parent directory.
Change To Two Level Upper/Parent Directory
We can also use .. to change multiple levels of upper directories. In this example, we will go two-level upper directory with multiple .. . We will also use / in order to specify the directory level.
Change To Sibling Directory
We can change to the sibling directory. We will use .. to go one level upper directory and provide the sibling directory name like Downloads .
Change To Root Directory
The root directory is the highest level of the directory for the current partition or drive. We can directly change to the root directory with the cd\ command without providing extra information.
Print/Display Current Working Directory
While working and changing directories we may be lost in the paths. In some cases, we may need to print the current directory. The current working directory is the path we are currently working and can be printed with the %cd% environment variable like below. We will also use echo command to print the current working directory environment variable to the cmd.
Change Drive
Windows operating system generally used with multiple partitions or drives. While working with the cd command navigation between these drives may be required. We can change the current drive or partition just by providing the destination drive or partition name like d: , e: etc. In the following example, we will change the current working partition to the D .
Change Drive and Directory
We can also change the current working partition and directory in a single and same command. WEe just need to provide the partition/drive name with the path or directory we want to change. In this example, we will change to the D partition Backups\2019 .
Change Directory By Saving Current Path
Navigating the directories in the command line is a very trivial task if there are a lot of different directories to change. pushd command can be used to change a new directory by saving the current path to memory. The saved path can be used with the popd command which is explained below.
Change Directory To The Saved Path
In the previous example, we have saved the paths and these paths can be easy with the popd command to navigate.
How to change Directory in Command Prompt on Windows 10
Windows Command Prompt is a great built-in tool that allows you to run programs using the command-line option. Using the command, you can perform a lot of things instantly on your Windows computer like troubleshooting and fixing certain kinds of challenging issues, switching or changing directory, and more.
As a Windows user, you must need to be well familiar with the basic commands and usage of the Command Prompt. In this guide, we will show you how to change directories in Command Prompt on Windows 10.
How to change Directory in CMD
If you want to change the directory in the Command Prompt, you have three options:
- Use Dir and CD command to change directories
- Use the Drag and Drop method
- Using the Tab key.
1] Using DIR and CD commands
To get started, open the Windows search using Win+Q keyboard shortcut.
In the text area, type cmd and then select Command Prompt from the result list.
Once you open the command prompt, type dir command to see the list of all subdirectories in the current folder.
In the above screenshot, you can see the list of all directories available in my folder named “digvi”.
Now suppose you want to change the current directory with the Documents folder from the list.
To do so, type cd followed by a space, type Documents and then hit Enter-
If you think you are in the wrong directory and want to change the directory then you first need to move a level back.
To do that, type the below commands and hit Enter:
After turning back, type cd followed by a space and then type the new directory name you want to change.
Make sure to remove the brackets from the above command-line and then press the Enter key.
For reference, you can see the above image, where I have changed the Documents directory to Downloads directory.
Once you change the directory name, again type dir to see the contents of the directory.
2] Using Drag and Drop
In case the folder you have to change is present on your computer screen, use the drag and drop method to reflect the pathname of the folder.
3] Using the Tab key
Additionally, you can use the Tab key to type the directory name quickly.
To do this, type cd > space > the first few letters directory name, then hit the tab key.
Hope this helps!
Date: July 27, 2020 Tags: CMD
Related Posts
How to uninstall a program using Command Prompt in Windows 10
How to remove virus from USB Flash Drive using Command Prompt or Batch File in Windows 10
Perform Arithmetic operations in Command Prompt on Windows 10
[email protected]
Digvijay is a Windows enthusiast who likes to write about the Windows OS and software in specific, and technology in general. When he is not working, he would either surf the web or dives into learning tech skills.