Poobah
New member
I was recently trying to make a program that appends a directory to the PATH environment variable, but I'm having trouble. I've been using the SET command, but it doesn't actually change the environment variables when it's called from within another program. So if I do something like:
within the program using C's system() function, the environment variable will not change at all, despite the fact that SET returns 0 to the program. Calling the exact same command in Windows' command prompt works fine. I've tried writing the command to a batch file, which didn't work, and I've also tried sending it to cmd.exe, which also didn't work.
So could someone recommend an alternative to the SET comand for changing environment variables?
Code:
SET "PATH=%PATH%;C:\Program Files"
So could someone recommend an alternative to the SET comand for changing environment variables?