cm3SetupCmdEnv.CMD Documentation

(last updated 01/20/2008 by RCC)

Purpose:

This Windows batch/command file sets up the environment for using cm3, including:  augmenting the PATH to find both the Microsoft Visual C binaries and the cm3 public repository for binaries; mangling the TEMP path to be a "short" path without embedded spaces; and setting several other environment variables useful for related command files, such as cm3Proj.CMD and cm3StartIDE.CMD.

Author / Distribution Rights: 

Randy Coleburn, Senior Systems Engineer, Scientific Research Corporation 
2300 Windy Ridge Parkway, Suite 400 South, Atlanta, GA 30339 

Author grants free use/modification/distribution of this batch/command file to anyone.
Author does not warrant this batch/command file.  Use at your own risk.

I can't promise to maintain this software, but if you have a problem or suggestion, you are welcome to send me an email at rcoleburn@mindspring.com
I will try to respond in a timely manner.

Caveats: 

You must be running WindowsNT4SP6, Windows2000, or Windows XP with command extensions enabled; otherwise, this command file will fail. 

Installation / Setup:

Store this command file in the bin directory of your cm3 installation. Place a shortcut to this command file on your desktop, then modify its properties to put "cmd /k" at the front of the command line. Now, when you invoke this shortcut, you will get a windows command prompt window whose environment is set up for using cm3. You can also call this command file from a command prompt window at any time to set up the environment.

Dependencies:

The CM3SetupCmdEnv.CMD file and cm3.exe must be in the bin directory of your cm3 installation.  They are used by this command file.

Environment Variable Usage:

The following five environment variables are setup automatically by the CM3SetupCmdEnv.CMD file:

CM3_ROOT is the root of the CM3 installation, typically "C:\cm3
CM3_BIN is where the CM3 binaries are kept, typically "C:\cm3\bin
CM3_PKG is the location of the public package repository, typically "C:\cm3\pkg"
CM3_IDE_EXE is name of the IDE executable, e.g., Reactor, CM3IDE
CM3_DoneSetup indicates if this command file completed successfully.
CM3_IDE_HOME is where CM3IDE looks for the user's home folder
REACTOR_HOME is where Reactor looks for the user's home folder.

The following environment variables are used internally and are considered temporary:

CM3Setup_RP
CM3Setup_HP
CM3Setup_IDE
CM3Setup_ExitCode
CM3Setup_SavePrompt

The following environment variables define the default locations.  You can edit these in the section of the command file labeled "DEFAULT_LOCATIONS" to change the defaults.

CM3Setup_DefaultInstallRoot
CM3Setup_DefaultTemp
CM3Setup_DefaultVCSetup
CM3Setup_DefaultSDKSetup

User Help:

Basic Usage:

cm3SetupCmdEnv [Help | Remarks | Show | Undo | [Root [path]] [Home [path]] [IDE exeName]]

Optional Command Line Arguments:

HELP

Display this summary of helpful information.  HELP cannot be combined with other arguments.

REMARKS

Display useful remarks located at the beginning of this command file.  REMARKS cannot be combined with other arguments.

SHOW

Display a summary of the current CM3 environment variable values.  In this case, no variables are changed, they are just displayed.  SHOW cannot be combined with other arguments.

UNDO

Indicates you want to undo the effects of the most recent invocation of this batch/command file.  Note that mangling of the TEMP and TMP variables can not be undone.  Consecutive invocations using UNDO is pointless, but won't hurt anything.  UNDO cannot be combined with other arguments.

ROOT path

The optional "ROOT" argument indicates you want to specify the cm3 installation root.  The "path" argument also is optional, but if given, should be the path to the cm3 installation root.  If the "path" argument is omitted, a default will be used (typically C:\cm3).  The "ROOT path" option is useful if you have multiple cm3 installation roots (e.g., different versions) and you want to switch between them, or if your installation is not in the default location.

IDE exeName

The optional "IDE" argument indicates you want to specify which IDE should be set as the primary one to launch via subsequent calls to cm3StartIDE.  The "exeName" argument is required and should specify the name of the executable program minus the .exe extension, e.g., "reactor", "cm3ide".  This program must exist in the bin folder of the cm3 installation root.  If no IDE argument is given, the default action is to search for one in the %CM3_BIN% folder. 

HOME path

The optional "HOME" argument indicates you want to specify the location of the IDE's (e.g., Reactor, CM3IDE) home folder for this user.  The "path" argument also is optional, but if given, should be the path to the home folder.  If the "path" argument is omitted, a default will be used, typically "%USERPROFILE%\My Documents\ReactorHome" or "%USERPROFILE%\My Documents\CM3_IDE_Home".

All keyword arguments are case-insensitive.

Examples:

cm3SetupCmdEnv

cm3SetupCmdEnv UNDO

cm3SetupCmdEnv HELP

cm3SetupCmdEnv REMARKS

cm3SetupCmdEnv ROOT path

cm3SetupCmdEnv ROOT

cm3SetupCmdEnv ROOT path HOME path

cm3SetupCmdEnv ROOT HOME path

cm3SetupCmdEnv HOME path

cm3SetupCmdEnv HOME

cm3SetupCmdEnv HOME path ROOT path

cm3SetupCmdEnv HOME ROOT path

cm3SetupCmdEnv ROOT path HOME

cm3SetupCmdEnv ROOT HOME

cm3SetupCmdEnv HOME path ROOT

cm3SetupCmdEnv HOME ROOT

cm3SetupCmdEnv ROOT path IDE name

cm3SetupCmdEnv IDE name

cm3SetupCmdEnv HOME path IDE name

cm3SetupCmdEnv HOME IDE name

cm3SetupCmdEnv ROOT path HOME path IDE name

cm3SetupCmdEnv SHOW

Notes:

When completed successfully, the variable CM3_DoneSetup=TRUE is set. You can check this variable in other batch/command files to avoid calling CM3SetupCmdEnv.CMD again unnecessarily. 

Also, the ERRORLEVEL is set to 0 for successful, 1 if unsuccessful due to invalid arguments, 2 if unsuccessful in determining proper environment settings, or 3..255 if an unknown error occurred.