Archive for the 'bat' Category

18
Nov
09

setting batch variables from a file


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.

26
Aug
09

current directory in batch files


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.