Use Command Files to Switch Directories Easier on Windows

We all have our own preference of which operating system works best for us, and helps us enhance our productivity. Over time, we also devise our own ways to make the operating system work better for us, and to train ourselves to work better on our computers.

I’m trying to note down things that have helped me while using Windows – to the point that I feel that my setup is geared towards me, and it sometimes, becomes a challenge when using someone else’s computer temporarily.

This is a very short post about one of the techniques that saves me a bit of time every now and then.

As you know, when you’re on the command line, you need to do something like c: or d: to switch drives. I discovered once that I was often accidentally leaving the “:” off that and would be prompted with a terse remider that a drive letter is not a command.

'c' is not recognized as an internal or external command,
operable program or batch file.

So, after reading that message many, many times over many months, I decided to take Windows up on the last 2 words – batch file and created a bunch of command files/ batch files that would get invoked instead.

So, this is all it takes – create a file called c.cmd and put this into it:


Repeat the same for other drives: d.cmd, e.cmd and so on.

Then, I put these files into a directory on my Windows path so that now, in my command window, I can just do:




There it is – I am on D: now.

C:\ is Special

While this technique works well for me in most cases, I do make an exception for C Drive. Normally, the default directory that you would change to on C Drive if you did just C: would be something like c:\windows\system32 or C:\Users\[YOUR_USER] or similar. I found that in most cases, I would also change the path again after that.

For this reason, my c.cmd does not actually follow what I wrote earlier. I changed it to be as below so that it changes to C: and also moves to the root directory directly. The c.cmd actually looks like this for me:

cd \

Keep in mind that this behaviour is not exactly what you intend when you do C: and so, you should decide if this makes sense for you – in my case, it was a common enough case that I chose to do it this way.

comments powered by Disqus