What is the reason for switching CD / D in Windows cmd?

First, I would like to say that I understand the purpose of the switch /Dfor the Windows command line command cd. I'm just wondering why this works this way and not the other. As we all know, he does the following:

Use the / D switch to change the current drive in addition to changing the current directory for the drive.

But every time I enter (for example) cd F:, it is obvious enough that I would like to change the drive. That is why I believe that this switch is redundant in itself.

So, which point explicitly sets this switch? Why is this not implied by default?

+4
source share
2 answers

The short answer is: since DOS behaved in this way, but is cmdtrying to mimic DOS.

DOS originally had a "current director" for each disc, so if you write cd d:\folder, you change the current directory for the disc D.

You can read more about this here: http://blogs.msdn.com/b/oldnewthing/archive/2010/10/11/10073890.aspx

+4
source

, DOS , , , 80x25 . , - , . , . , . , . .

, :

dir a:           <- See what dir I need
cd a:foo         <- This one
dir a:           <- See what file
dir b:           <- See what dir I need
cd b:bar         <- This one
dir b:           <- See what file
a:program b:data <- use them both

:

dir a:                <- See what dir I need
cd a:foo              <- This one
dir a:                <- See what file (lots of scroll)
dir b:\               <- See what dir I need (scroll)
cd b:\bar             <- This one
dir b:                <- See what file (lots of scroll)
a:\foo\program b:data <- use them both (had to remember "foo")

.

, , , .

+4

Source: https://habr.com/ru/post/1608982/


All Articles