Environment Variables (used to configure or store information) |
Environment variables can be used to configure your scripts to handle multiple users requirements and are used in batch files as program "variables".
The "SET" command is used to set a variable and "%VariableName%" is used to read/use the value as shown below:
SET ToolsDir=C:\Tools echo My tools directory is at "%ToolsDir%" :-)
If you see a script with something like:
SET BackupThisDir=C:\Tools SET BackupThisDir=C:\MAKEMSI ...
The the last set for that environment variable is the one that the script will use as it has replaced the value set in the previous line. This can be done so you can quickly swap the order or leave as examples for others.
If you are getting weird unexplained issues look for incorrect matching of "%", particularly in "IF" commands.
Some handy links for more information: