joehua
joehua

Reputation: 735

"CD /D C:\" doesn't do a thing

At the end of a batch file, I have this command:

 CD /D C:\

I want to change the directory to C:\ but the line doesn't do a thing.

This is what is on the screen:

 D:>CD /D C:\
 D:>

At this moment, if I enter manually "CD /D C:\", I can change directory to C:.

What should I do to make it work?

Upvotes: 2

Views: 738

Answers (2)

t.anonymous
t.anonymous

Reputation: 54

There is an easier way of doing this, if you are in the D:/ drive, and you want to switch to the C:/ drive, you can just type the drive letter that you want to switch to followed by a colon for example you are in the C:/ drive and want to switch to the D:/ drive, type just D: on a line, it will then switch the current drive.

Upvotes: 0

Stephan
Stephan

Reputation: 56188

you probably have a setlocal in your batch script. The following should work:

... your batchfile
endlocal
cd /d c:\

Upvotes: 3

Related Questions