How to print the current directory in a Windows bat file (like pwd on Linux)

Use the cd variable.

Example:

echo %cd%

Author: Tang Moying

Source: /en/post/windows-pwd

License: this article is shared under "CC BY 4.0". Please credit the author and link back to the original when republishing.