Hopefully "ScriptingTipsAndTricks" helps you with your batch file or vbscript scripting :-)
[Bottom][Contents][Prev]: Current Directory (or Drive)[Next]: PROCESSOR_ARCHITECTURE
\->Introduction->Environment Variables (used to configure or store information)

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:


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Current Directory (or Drive)[Next]: PROCESSOR_ARCHITECTURE


ScriptingTipsAndTricks© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday September 07 2014 at 12:50pm
Visit ScriptingTipsAndTricks's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.