This tutorial will teach you how to change directory in Command Prompt in Windows 10. This tutorial is applicable to both 32-bit and 64-bit versions of Windows 10.
Every Windows machine comes with a command prompt, which is a command line environment that is very useful for system administration. Many Windows users never even use the command prompt, but it’s always available and is a great troubleshooting tool. The command prompt window has lots of features you can use to help you save time and troubleshoot Windows problems.
In this article, we will show you how to change the directory in the Command Prompt in Windows 10. This is a simple task that can be done by anyone. If you want to change the current directory in Windows 10 Command Prompt, follow this article.
The Command Prompt is one of Windows 10’s finest features, allowing users to execute different commands and troubleshoot a variety of problems. In the Microsoft user community, it’s referred to as ‘CMD.’ Using this tool, you may learn to perform a variety of simple instructions. How to change directory in CMD is one of these procedures.
Prior to the introduction of the graphical user interface, all actions on Windows DOS were carried out via commands. These included commands for renaming folders, finding files and folders, deleting files, switching directories, and many other things. As a consequence, a variety of Command Prompt tips may assist you in completing tasks more efficiently.
In CMD, there are four ways to change the directory.
The CD command is the command for changing the directory. The default path is set to C:WindowsSystem32 in administrator mode or C:Users in regular mode when you start the Windows Command Prompt in any version.
There are four methods to alter the directory in CMD. Let’s look at how to change directory in CMD in more detail.
1. Using the CD Command to Change Directory in CMD
It’s easy to change the current working directory in the Command Prompt. For this, you’ll need to launch the Command Prompt in regular mode.
To begin, hit Windows key + R to bring up the Run command. Then, in the search box, type CMD and click Ctrl + Shift + Enter to launch the elevated Command Prompt window.
You may change the directories on the Command Prompt and browse to other directories and files by using the command CD.
Type cd + to navigate to a particular directory (directory location). cd C:Program Files, for example.
Type cd + to open a particular folder (folder name). cd Common Files, for example.
After utilizing the CD Windows command line, you can see that the directory has been renamed to Common Files.
You may accomplish it in the following manner to enter the subdirectory with a single command.
C:Program Files (x86) Files in Common
Users may use the command cd.. to go up a level in the Windows directory tree they’re presently in. When we execute this command, the Program File folder becomes the primary directory in our instance.
Following that, you may use the dir command to inspect the current directory’s subdirectories, as illustrated in the picture below.
You can view all the folders (directories) in the Program Files folder with the dir command.
If you want to get to the root level directory from anywhere in the file system, enter cd and press Enter. After executing the command, we were transported to the C drive – the root directory.
2. Modify The Command Prompt’s Paths
If you’re not sure how to change directory in CMD, start by altering the Command Prompt’s paths.
Note that there are two ways to run this function. Both have been thoroughly described here. You have the option to modify any of the routes to your liking. If the first doesn’t work, go on to the next.
Option 1: Alter the path’s beginning.
To begin, type CMD into the Start menu search box, then right-click on ‘Open file location’ in the right pane and choose it.
Select Properties from the context menu by right-clicking on the Command Prompt.
Change the Start-in path to a place of your choosing in the Shortcut tab. Then, to save the changes, click Apply and OK.
Once you’ve finished making the modifications, double-check that the route has been updated properly. This technique will only work if the Command Prompt is opened in regular mode.
Option 2: Modify the Destination Folder
If the Start in approach doesn’t work, try changing the Command Prompt’s target folder and seeing if it solves the problem.
You’ll need to repeat the steps from the prior approach. The only difference is that the Target path is changed to:
system32CMD.exe /k “cd C:” % windir % system32CMD.exe /k “% windir % system32CMD.exe /k
The letter ‘C’ denotes the drive, which is the location of our desired directory path. Make careful to specify the folder along with the disk if you choose a folder as your preferred path. When you execute Command Prompt with administrator rights, this will alter the current working directory.
3. Take use of the Registry Editor
If the preceding methods haven’t worked, you may use the registry editor to learn how to change directory in CMD. We suggest that you use this only after you’ve tried the other options.
To begin, launch the Run command by using the Win key + R keyboard shortcut. Then, in the search box, type ‘regedit’ and hit the Enter key.
After that, follow the directions below.
ComputerSoftwareMicrosoftCommand ProcessorHKEY CURRENT USER
Right-click in the right pane of the Command Processor folder, choose New, and then String Value. ‘Autorun’ is the name of the String Value.
Update the value data to cd /d C:Program Files by double-clicking on the newly formed Autorun. Program Files is the folder inside the drive letter (directory) C. Then, to save the changes, hit the Enter key or click the OK button.
4. Using A Batch File To Change The Directory
Another, though more complicated, way is to use Command Prompt to create a batch file and alter the default directory. This technique necessitates the creation of a batch file.
To create a batch file, you must first start a new Notepad document. Then type the following script. For this example, we used the following location (C:Program FilesCommon Files). You may choose the relative route that best suits your needs.
set path=C:Program FilesCommon Filescd% path% set path=C:Program FilesCommon Filescd% path%
In this case, the path is a script variable. You are free to use whatever variable name you like, as long as you make the necessary modifications to the script.
After that, save the file as a.bat file. Also, make sure that All Files is selected in the Save as type box before saving the file.
Open the Command Prompt now. To make the desktop your default directory, type cd desktop and press Enter.
The batch file has been saved to the Desktop. You’ll need to go to that directory/folder if you stored it somewhere else.
Then, to start the bat file, type its name and hit the Enter key.
After running the batch file, you’ll see that the Command Prompt’s default directory has been modified. That’s all there is to it when it comes to changing directories in Command Prompt.
Conclusion
One of the most important features in Windows 10 is the Command Prompt, which enables users to address problems with particular instructions. There are many ways to learn how to change directory in CMD in Windows 10; choose the one that is most intuitive to you.
You must use the Command Prompt in normal mode to modify the default home directory. Use the registry editor technique only after you’ve exhausted all other options for changing the directory. It’s also a good idea to back up your registry settings before making any changes so that you can easily restore them if anything goes wrong.
With the Windows 10 Anniversary Update, you can quickly access the command prompt utility by clicking the Start button, typing cmd, and pressing the Enter key. This is a convenient shortcut, but there are times when you may want to get back to the command prompt utility from a different location. In this article, we’ll show you the steps to change the directory in the command prompt utility from where you launched it.. Read more about command prompt change directory and let us know what you think.
Frequently Asked Questions
How do I change directory in CMD?
In order to change directory, you would need to use the cd command. For example, if you wanted to change your current directory from C:\Users\UserName\Desktop to D:\Documents\Projects, you could type in the following command: cd d:\documents\projects
How do I change a directory from C to D in CMD?
You can use the command chdir D to change directory from C to D.
Related Tags
- how to navigate to a folder in cmd windows 10
- how to change directory in cmd from c to d
- how to change directory in cmd to desktop
- how to open a folder in command prompt
- how to change directory in terminal