If you need to store a variable to a file, and then need to read it back, you can do it like this:
set /p variable=<file.txt
assuming your file’s name is file.txt.
If you need to store a variable to a file, and then need to read it back, you can do it like this:
set /p variable=<file.txt
assuming your file’s name is file.txt.
If you ever need the current directory in a batch script, you can get it through the environment variable %CD%. To see all the environment variables defined by the shell for you, run this :
set /?
Source of this was this MSDN blog.