batch script to set a variable with the current path location April 11, 2023 by Tarik The current directory is in the “shadow” variable cd. You could try set "var=%cd%"