I was using the Windows Console recently and by default the console opens up with the current user directory.
C:\Users\Adhithya>
My computer has several drives. One of the drives is named D. I wanted to navigate to a folder in the D drive from the console. You can usually run the cd command to navigate to folders from the console. So, I tried to do something like
C:\Users\Adhithya> cd D:\folder
But nothing happened. When you look at the console, the current directory is still C:\Users\Adhithya
C:\Users\Adhithya> cd D:\folder
C:\Users\Adhithya
Why is that?
It turns out that cd by default only navigates with in the current drive. If you wanted to navigate to a different drive, you can do it in two ways.
You can enter the name of the drive followed by a colon on the console and hit enter. This will make the console shift the to the new drive. For example: If you want to switch to the drive D like I had to, you can run D:
C:\Users\Adhithya> D:
D:>
Once you have successfully switched over to the new drive, then you can run the cd command to navigate to the folder that you want.
D:> cd folder
D:\folder:>
Yay!!!
The second way is to pass additional options to the cd command to modify its default behavior. The \d flag tells the cd command that the location that we are trying to navigate is in a different drive. So, can try something like this
C:\Users\Adhithya> cd \d D:\folder
D:\folder>
Hope this helps. If you are using Powershell or Windows Terminal, you can read this article
Leave a comment