How to set an environment variable and start a process in ANSI C for Windows? If possible I want to avoid using any Windows API for this.
Assuming portability is your reason for specifying ANSI C, you can do exactly what you want with the POSIX function _execve
:
This is a portable function that spawns a new child process and allows you to supply an array of environment settings.