A Quest for Technical Expertise

A never ending odyssey for technical knowledge enrichment!

How to change drive from within a Microsoft Windows batch file?

leave a comment »

The Microsoft Windows Command Line batch file is a powerful technique to automate repeated tasks. Quite frequently, you will be in need of changing a drive in a .bat script. This can be accomplished using the below command from within .bat script:

cd /D <drive>

Example:

cd /D G:

To navigate to a directory within some drive from some other drive, try:

cd /D <drive>:\<folder>

Example:

cd /D G:\foo


References:
Advertisement

Written by Santhosh

January 17, 2012 at 6:59 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.