how to change the current directory and print it in one line?
I tried C:\dir1> cd /d D:\dir2 && echo %cd%
but it prints C:\dir1
how to change the current directory and print it in one line?
I tried C:\dir1> cd /d D:\dir2 && echo %cd%
but it prints C:\dir1
You should be able to do cd /d D:\dir2 && cd
According to the windows cmd help page for cd/chdir this will display your current directory:
Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.