Any reason to split the "cd" commands on Windows?

I clear some old Windows batch files at work and continue to see lines like this:

D:
cd\
cd some\other\path\

Is there any reason (compatible with command.com, maybe?) To not just write it like

cd /d d:\some\other\path\
+2
source share
1 answer

cddoes not actually change the working disk; it only changes the working directory for this drive. That's why he crashed so much.

An example might help:

C:\users\david>cd D:\some\path
C:\users\david>

Please note that the drive has not changed.

C:\users\david>D:
D:\some\path>

Now that D: is the "working disk", the working directory changes to what you specified earlier.

, cd /d . [UPDATE: , , /d :( - sorry]

, - "" - COMMAND.COM(, , /d), script .cmd, , COMMAND.COM.

IMHO pushd, cd /d, , ( popd). pushd UNC- (\\server\share), Windows . ( , Win 7 Pro, , / Home.)

+4

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


All Articles