Environment variables can be referenced on the command line.
This allows you to set an environment variable outside of Memory Validator (cmd prompt, batch file, etc) and then reference it on the command line.
If the BUILD_DIR environment variable is set to e:\dev\debug the above would evaluate to -program e:\dev\debug\testProgram.exe
There are situations where you it isn't desirable, or possible to set the environment variable value prior to starting Memory Validator.
In those situations you can set the environment variable on the command line using -setenvironment.
-setenvironment BUILD_DIR=e:\dev\debug -program %BUILD_DIR%\testProgram.exe
If you are running from a command prompt, or batch file, or any process that will handle environment variable substitution using %ENV_VAR% you will find that referencing the environment variable on the command line won't work when using -setenvironment, because by the time Memory Validator sees the command line the %ENV_VAR% values have already been substituted.
To get around this, using $ENV_VAR$ instead of %ENV_VAR%.
-setenvironment BUILD_DIR=e:\dev\debug -program $BUILD_DIR$\testProgram.exe
Set environment variables for Memory Validator, as a series of name/value pairs.
Use this option once for each environment variable you wish to set.
Usage of -setenvironment for any environment variable must appear on the command line prior to any reference to that environment variable on the command line.
To pass quotes along with the string, escape a pair of inner quotes like the example below
-setenvironment "APP_COMMS=ON; APP_DEBUG=OFF;"
-setenvironment "APP_MSG=\"A quoted string with spaces\";"
Note that this is not the same as -environment, which allows you to specify environment values that you can pass to the program being launched.