- How to Change Directory in CMD | How to Use CD Command Win 10 [MiniTool News]
- Summary :
- What Is CD Command in Windows?
- How to Change Directory in CMD Windows 10
- How to Change Directory in CMD with CD Command
- Step 1. Open Windows Command Prompt Utility
- Step 2. How to Use CD Command in CMD to Change Directory
- Bottom Line
- ABOUT THE AUTHOR
- 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 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]
- Change Directory in Windows Batch Script
- 2 Answers 2
- Change to Drive Letter
- Delims
- Compact
- Command Prompt: 11 basic commands you should know (cd, dir, mkdir, etc.)
- 1. How to change the directory (folder) in Command Prompt (CMD)
- 2. How to change the drive in Command Prompt (CMD)
- 3. How to view the contents of a directory in Command Prompt (CMD)
- 4. How to create a new directory with Command Prompt (CMD)
- 5. How to rename files and folders with Command Prompt (CMD)
How to Change Directory in CMD | How to Use CD Command Win 10 [MiniTool News]
By Alisa | Follow | Last Updated March 04, 2021
Summary :
This tutorial gives a detailed guide on how to change directory in CMD (Command Prompt) in Windows 10 computer. Learn how to use CD command in Windows Command Prompt to access different directories and folders. FYI, MiniTool software designs a free data recovery software program allowing you to recover any deleted/lost files from Windows 10/8/7 computer and other storage devices.
Windows Command Prompt (cmd.exe) lets you do many things quickly on your Windows computer. Wonder how to change directory in CMD? You can use the CD command to easily do this.
What Is CD Command in Windows?
The CD command refers to “change directory”. It is a professional Windows Command Prompt change directory command. You can use CD command to easily change the current working directory in CMD in Windows 10, and open different directories or folders on your Windows 10 computer. Check how to use CD command to change directory in Command Prompt below.
How to Change Directory in CMD Windows 10
- Open elevated Command Prompt
- Use the CD command to change directory in CMD
How to Change Directory in CMD with CD Command
Step 1. Open Windows Command Prompt Utility
Before you use Command Prompt to change directory, you should enter into Command Prompt at first.
You can press Windows + R, type cmd, and press Ctrl + Shift + Enter to open elevated Command Prompt in Windows 10.
Step 2. How to Use CD Command in CMD to Change Directory
Then you can type CD command lines in CMD to change different directory or folder paths.
If you want to go to a specific directory, you can type cd + full directory path, e.g. cd C:\Program Files.
To open a particular folder, you can type cd + full folder path, e.g., cd C:\Program Files\office.
To go up a directory level you are currently working, you can type cd ..
To check the whole subdirectories and folders in the current directory, you can type dir command.
To go to the root level directory from any directory, you can type cd \.
To change the current drive, you can firstly type cd \ to go to the root directory, and then enter the drive letter followed by a colon to enter the target drive, e.g. I:.
To change the drive and directory at the same time, you can use CD and the /D switch simultaneously, e.g., cd /D I:\MiniTool Partition Wizard 11.
Bottom Line
Now you should know how to change directory in Command Prompt (CMD) by using CD command in Windows 10. You can easily access different directories or folders with CD command Windows in Command Prompt.
If you can’t find a file or folder in your Windows 10 computer, you may lost it or mistakenly deleted it, you can easily recover the file or folder with MiniTool Power Data Recovery.
MiniTool Power Data Recovery is a professional free data recovery program compatible with Windows 10/8/7. You can use this software to easily recover data from various data loss situations.
Namely, you can recover any deleted/lost files from Windows 10/8/7 computer, external hard drive, USB/thumb/pen drive, SD card, and more.
For the data loss due to mistaken file deletion, system crash and other computer system issues, hard drive failure, malware/virus infection, etc. you can use MiniTool Power Data Recovery to easily retrieve the lost files and data.
ABOUT THE AUTHOR
Position: Columnist
Alisa is a professional English editor with 4-year experience. She loves writing and focuses on sharing detailed solutions and thoughts for computer problems, data recovery & backup, digital gadgets, tech news, etc. Through her articles, users can always easily get related problems solved and find what they want. In spare time, she likes basketball, badminton, tennis, cycling, running, and singing. She is very funny and energetic in life, and always brings friends lots of laughs.
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 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.
Change Directory in Windows Batch Script
Based on some other answers I found, I can loop through available drive labels. However, I can’t seem to change to that drive:
But what I want is it to go to drive c:, d:, etc. and run a command.
I know normally I could do something like
but I’m making a script to compress (compact) the contents of every drive, but it doesn’t seem to take the parameter correctly as it doesn’t go through all the files when I do:
which only affect the root of d:
which affects every file and directory on d:
2 Answers 2
Change to Drive Letter
To change to a specific drive letter while the command prompt directory is using a different drive letter than the one you need to change to, simply use the /D parameter with the CD command (e.g. CD /D : ) to change to a different drive letter before running proceeding commands.
Delims
You should omit using the delims=» in the FOR loop as that tells it that space is not a delimiter which is not what you want to prevent that cr/cr/lf issue as per the LotPings comment.
Since it states the default delimiter set of space and tab when you put delims=» just like that with the ending double quote after the equal sign =» , that tells it there are no delimiters now.
Compact
Since Compact runs against files in the directory without specifying the path in an argument, if applicable, you can first CD /D : and then run Compact /C to compact all files in a directory, or Compact /C /S to compact all files and folders recursively in the directory.
Command Prompt: 11 basic commands you should know (cd, dir, mkdir, etc.)
Geeks and experts love the Command Prompt because of the advanced commands it can run. Fortunately, Command Prompt is not built only on advanced commands, but also on simple ones, designed to perform basic operations. In this article, we show you how to execute commands such as changing the current directory, switching to another drive, viewing the contents of a directory, creating and renaming folders, copying, deleting files and folders, and launching applications from the Command Prompt. We are also going to show you how to get help when using this app for Windows. Let’s get started:
NOTE: The information shared in this tutorial applies to Windows 10, Windows 8.1, and Windows 7. Note that, for simplicity, we are using screenshots taken only in Windows 10.
1. How to change the directory (folder) in Command Prompt (CMD)
The first command from the list is CD (Change Directory). This command enables you to change the current directory or, in other words, to navigate to another folder from your PC. For instance, the command CD takes you to the top of the directory tree. To see how it works, after you open the Command Prompt, type cd and press Enter on your keyboard. You should see how the CD command takes you to the top of the directory tree. In this case, to the “C:” drive.
Note that the Command Prompt is not case sensitive, meaning that you can type commands using capital letters, lowercase or any combination of them. The commands CD, cd or Cd, all work the same way.
Going back to the “CD” command, now you are working on the root of the “C:” drive. If you need to go to a specific folder from this drive run the command “CD Folder.” The subfolders must be separated by a backslash character: “.” For instance, when you need to access the System32 folder located in “C:\Windows,” type “cd windows\system32” as shown below, and then press Enter on your keyboard.
When you need to go one folder up, use the “cd..” command. Let’s assume that you want to go back to the Windows folder. Type “cd..” and press Enter on your keyboard.
The effect is that your current directory changes to “C:\Windows.”
2. How to change the drive in Command Prompt (CMD)
To access another drive, type the drive’s letter, followed by “:”. For instance, if you wanted to change the drive from “C:” to “D:”, you should type “d:” and then press Enter on your keyboard.
To change the drive and the directory at the same time, use the cd command, followed by the “/d” switch. The “/d” parameter is used to change the current drive to a specific folder from another disk volume.
For instance, if you are now on the “D:” drive and you want to go back to the Windows folder from the”C:” drive, you should type “cd /d C:\Windows” and press Enter on your keyboard, like in the following screenshot.
NOTE: By typing only the drive letter you automatically move to your most recent location on that drive. For instance, if you are on “D:” drive and type “cd c:\windows” nothing seems to happen. However, if you type “c:” then the working folder changes to “c:\windows,” assuming that it was the last folder you worked with on your “C:” drive.
3. How to view the contents of a directory in Command Prompt (CMD)
You can view the contents of a folder by using a command called DIR. To test it, we have created a folder named Digital_Citizen on the D: drive, with several files and subfolders. You can see them in the screenshot below.
The last time, our working folder was “C:\Windows.” To navigate to the folder mentioned above, we have to use the command “cd /d D:\Digital_Citizen.” To view the contents of the folder, type DIR, and press Enter. The list of the files and folders contained by it is displayed, together with some details about each of them (the size and the date and time when they were last modified).
4. How to create a new directory with Command Prompt (CMD)
You can make a new folder using the MKDIR (Make Directory) or the MD command. The syntax of these commands is “MKDIR Folder” or “MD Folder.”
Let’s say we need to create a new folder called Digital_Citizen_Life that is going to be placed in the “D:\Digital_Citizen” folder. To do that, we need to type “mkdir Digital_Citizen_Life” and then press Enter, as shown below.
To test if it worked, use the DIR command again. The newly created folder appears in the list.
NOTE: Do not forget that all these commands depend on the current location in the Command Prompt. For instance, if you are on the “C:” drive and type “MKDIR test,” the new folder is created in the root of the “C:” drive.
Another way to create a folder that does not involve being in the desired folder is to type the complete path of the new folder. For example, if you are working on the “D:” drive and you want to create a new folder in “C:,” called other_stuff, type “mkdir c:\other_stuff” and then press Enter.
When you need to create a folder with subfolders at the same time, you can use the “MKDIR FolderSubfolder” command. For instance, if we type “mkdir Digital_Citizen_Tests\Beta\Test1” three folders are created: Digital_Citizen_Tests, Beta and Test1, in a tree-like structure.
5. How to rename files and folders with Command Prompt (CMD)
To rename files and folders, you need to use the REN (Rename) command. To rename folders, type “ren Folder NewFolderName.” For example, if we wanted to rename the Digital_Citizen_Tests folder to Digital_Citizen_Final_Tests, we should run “ren Digital_Citizen_Tests Digital_Citizen_Final_Tests” and press Enter.
To rename a file, use the same command, like this: “ren filename.extension newname.extension”. For instance, to rename the Digital_Citizen_Picture1.bmp file to Image0.bmp, we have to run the command “ren Digital_Citizen_Image1.bmp Image0.bmp” command.
Read the second page of this tutorial if you want to learn how to copy files and folders, delete files and folders, start an application, and get help when using the Command Prompt.