How to change drive from within a Microsoft Windows batch file?
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