Building Software -- Working with the Command Shell for Windows 2000/XP/2003
Building a Web Server, for Windows
The Command Shell
Open the command shell (also referred to as the command-line)...
Start » Run : cmd.exe
Example: Change the directory and drive...
Change to the root directory (C:\) of the current drive...
Change to another drive and its root directory (E:\)...
Change to a top-level (specified by the beginning '\') directory (E:\Program Files\) that contains a space -- has to be quoted...
cd \"Program Files"
Change to directory (E:\Program Files\Apache2\) -- since no beginning '\' is used, this directory must be located under the present directory (E:\Program Files\)...
Setting the Build Environment
When using the command-line with Visual C++, the environment has to be set. There are several ways to perform this task. Note that this will only hold for the current cmd.exe window.
- VS.NET : open the Microsoft Visual Studio .NET Command Prompt, which will have the proper environment set.
- VS.NET : run ...\Microsoft Visual Studio .NET\Common7\Tools\vsvars32.bat under the regular command prompt, which will set the environment.
- VC++ (VS98) : run ...\Microsoft VisualStudio\VC98\bin\vcvars32.bat under the regular command prompt, which will set the environment.
Working with the Build Environment
- The environment can be viewed with:
- An individual variable can be viewed with:
:\> echo %VAR%
- A variable can be set with:
:\> set VAR=value
- Multiple values for a variable can be set with:
:\> set VAR=value1;value2;value3
- Values can be added to a variable with:
:\> set VAR=%VAR%;more_values
Example: Setting the PATH
Environmental variable 'PATH' specifies the search path for executables (EXEs), libraries (DLLs), and other important files. This variable is often updated to reflect the additional tools that will be used during the build process.
Example for adding executables perl (under C:\www\perl\bin), awk, bison, flex, sed (under C:\GnuWin32\bin) to the PATH -- tools used in the Apache2 (and related) build process...
If using the command-shell (or Visual Studio .NET Command Prompt)...
:\> set PATH=%PATH%;C:\www\perl\bin;C:\GnuWin32\bin
[note that this method will only set the PATH temporarily and will only hold for the current cmd.exe window]
- Set PATH under Start » Settings » Control Panel » System » Advanced » Environment Variables » System variables » Path
[this will set the PATH permanently]
If using the Visual Studio Workspace IDE...
- Open menu Tools » Options » Projects » VC++ Directories
- Select 'Executable files' under 'Show directories for:'