Is it possible to set the environment variables of a process “A” in a way that they will be valid only for its current run (process “A” will be started by my process) using C++?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you are prepared to rely on the Windows API, when you call the
CreateProcessfunction to launch a process, you have thelpEnvironmentparameter.Normally you pass
NULLwhich means, use the environment of the creating process. However, you can supply an environment block which will be used by the new process.The environment block that you pass is a null-terminated block of null-terminated strings. For example:
defines two separate variables.