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
Run it and it works fine within in itself, but run the exe as part of a batch file like:Code:#include <stdio.h> #include <stdlib.h> int main() { putenv ("TEST=Works"); system ("echo %TEST%"); return 0; }
test.bat
And it treats %TEST% like it is unassigned outside of the program.Code:@echo off setenvtest echo %TEST% pause
So how do I fix that?



LinkBack URL
About LinkBacks



