How to assign chdir to a variable in .bat? How to assign chdir to a variable in .bat? bash bash

How to assign chdir to a variable in .bat?


The current directory is available in the pseudo-variable %cd%. So:

set X=%cd%

stores it in a variable named X.