How To Modify the Environment for a Spawned Process
Article ID: 11997
Article Last Modified on 7/2/2004
APPLIES TO
- The C Run-Time (CRT), when used with:
- Microsoft C/C++ Professional Development System 7.0
- Microsoft Visual C++ 1.0 Professional Edition
- Microsoft Visual C++ 1.5 Professional Edition
- Microsoft Visual C++ 1.0 Professional Edition
- Microsoft Visual C++ 2.0 Professional Edition
- Microsoft Visual C++ 4.0 Standard Edition
- Microsoft Visual C++ 5.0 Standard Edition
- Microsoft Visual C++ 6.0 Service Pack 5
This article was previously published under Q11997
SUMMARY
The text below discusses the process through which an application can
modify the PROMPT environment variable in a spawned process. Use the
same procedure to modify any environment variable in a spawned
process.
PROMPT is an environment variable used by MS-DOS, OS/2, and Windows NT. To
change the value for the PROMPT environment variable, use one of the
following two methods to specify the environment in which a child process
runs.
- Use one of the spawn*e() functions. See the run-time library
reference manual or the online help file provided with your
compiler for specific information about the spawn() family of
functions.
- Use the putenv() function to modify the environment in which your
application executes, then start the child process with one of the
spawn() functions. See the run-time library reference manual or the
online help file provided with your compiler for specific
information about the putenv() function.
In general, a process can alter only the environment in which a child
process will run. The C run-time library functions simulate the
ability to alter the environment space in which the current process
runs by making a copy of the environment when the process starts up
and allowing the process to modify the copy of the environment.
Keywords: kbhowto kbcrt KB11997