Gemini000 wrote:The reason why the cd command doesn't change the drive is because you can actually use it to change the active directory of the […]
Show full quote
The reason why the cd command doesn't change the drive is because you can actually use it to change the active directory of the non-active drive!
For instance:
D:\> c:
C:\> cd d:\stuffs
C:\> d:
D:\STUFFS>
😉
If it was me, I would have included an option to do that while making the optionless version switch to the drive and go into the directory, like you'd expect. It often seems like MS programmers went out of their way to make things as unintuitive as possible.
A while back I wanted to write a batch file to perform multiple operations on all files of a certain type, but I couldn't make it work properly. I was trying to manipulate the filenames using variables and they never contained the values that I expected. I had to ask on the net to learn that variable inside a For loop need to use Delayed Expansion. To be honest, I still don't understand exactly what it does or why anyone would need it to function that way. Regardless, it amazes me that anyone thought it would be a good idea to make this the default way that variables are handled inside a loop, which runs contrary to every other programming language I've ever used. Make it an option, not the default!
I have this image of two programmers kicking back, smoking a joint, when one says to the other "I just had a great idea! Let's make variables inside a loop act completely different than they do outside the loop. People will go nuts trying to figure out why their scripts don't work and then we can tell them that it's a special condition where they have to do extra crap to make it work." Then they both look at each other for a few seconds before busting up laughing.