I have a program that is trying to set the environment variable in a XP environment so that it can be used outside of the program. Unfortunately it seems that one the program terminates any environment variables that it creates are immediately forgotten. For example:
setenvtest.c
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
putenv ("TEST=Works");
system ("echo %TEST%");
return 0;
}
Run it and it works fine within in itself, but run the exe as part of a batch file like:
test.bat
Code:
@echo off
setenvtest
echo %TEST%
pause
And it treats %TEST% like it is unassigned outside of the program.
So how do I fix that?