简体   繁体   English

批处理:更改当前目录并在一行中打印

[英]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%我试过C:\dir1> cd /d D:\dir2 && echo %cd%

but it prints C:\dir1但它打印C:\dir1

You should be able to do cd /d D:\dir2 && cd你应该能够做cd /d D:\dir2 && cd

According to the windows cmd help page for cd/chdir this will display your current directory:根据 cd/chdir 的 windows cmd 帮助页面,这将显示您的当前目录:

Type CD drive: to display the current directory in the specified drive.键入 CD drive: 显示指定驱动器中的当前目录。

Type CD without parameters to display the current drive and directory.键入不带参数的 CD 以显示当前驱动器和目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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