简体   繁体   中英

batch: change current directory and print it in one line

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM