How to assign chdir to a variable in .bat?

I am trying to translate a bash script into a .bat script. The specific line I'm dealing with is this:

X=`pwd`

What is the .bat equivalent?

I need to take the directory where the script is currently running as a variable, so I can use a common relative path to search for files in the directory. I am running Windows-XP on the command line.

+5
source share
1 answer

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

set X=%cd%

stores it in variable X.

+8
source

All Articles