Using the Set Environment Variable Tool (Windows Embedded CE 6.0)

1/5/2010

You can use the command-line tool Set Environment Variable Tool (Setenv.bat) to set values for optional environment variables that are used in the command prompt build window environment. However, any environment variables that Setenv.bat sets should not overwrite variables that the IDE sets, such as %_FLATRELEASEDIR% or %_PROJECTROOT%.

If you want to use both the IDE and a command prompt build window to develop an OS design, use Setenv.bat to set values for environment variables depending on whether the build environment is created from a command-line batch file or in the IDE. This helps you avoid overwriting environment variables due to switching modes.

For more information, see Set Environment Variable Tool.

To use Setenv.bat

  1. If it does not exist on the development workstation, create the directory %_WINCEROOT%\Developr\%USERNAME%.

  2. Copy Setenv.bat from %_WINCEROOT%\Public\Common\Oak\Misc to %_WINCEROOT%\Developr\%USERNAME%.

  3. Edit Setenv.bat by setting the appropriate values for the variables you select.

    By default, the following environment variables are initially set in Setenv.bat:

    • IMGFLASH
    • IMGNODEBUGGER
    • WINCEDEBUG
    • WINCEREL

    The following sources file macro definitions are also set by default:

    • WINCEMAP
    • WINCECOD

    The variables set in %_WINCEROOT%\Public\Common\Oak\Misc\Setenv.bat are examples, and do not need to be kept after you copy the file to %_WINCEROOT%\Developr\%USERNAME%.

  4. Verify that the variables are set correctly by running set from the command prompt build window.

The following code example shows how to configure Setenv.bat so it sets %_FLATRELEASEDIR% only if the workspace is accessed from a command prompt build window.

if "%USING_PB_WORKSPACE_ENVIRONMENT%"=="1" goto PBWorkspace
REM – only set the flatreleasedir if this is not a Platform Builder workspace
Set _FLATRELEASEDIR=%_PUBLICROOT%\%_TGTPROJ%\RelDir\%_TGTPLAT%_%_TGTCPU%_%WINCEDEBUG%
: PBWorkspace

See Also

Concepts

Set Environment Variable Tool
Windows Embedded CE Build Environment Tool
Environment Variables

Other Resources

Creating a Command Prompt Build Window