setenviron not permanent?

Windows specific questions.
Posts: 355
Joined: May 29, 2015 20:37

setenviron not permanent?

Postby datwill310 » Sep 15, 2015 11:15

I've been programming a command prompt, and I've notice an odd behaviour with the setenviron function... Well, hence the way environment variables work, the behaviour is possible not so odd.
Whenever I change a variable's value, terminate the program, and reopen the program and display the same environment variable, the old value is still apparent and it seems that it has not been changed.
We all know that we have to restart/reboot a computer to make environment variable changes, but does this apply to changing it's value via FB code; it seems so?
Posts: 130
Joined: Sep 18, 2006 10:29

Re: setenviron not permanent?

Postby noop » Sep 15, 2015 11:28

Are you sure that FB changes them permanently at all (even after a restart)?
The way I have used environment variables so far (under Linux; not with FB), they are only valid for the current console. If you launch another console, you have the default variable values, unless you change them explicitly in a config file (or with a GUI under Windows).
Just sth. to consider.
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Re: setenviron not permanent?

Postby MichaelW » Sep 15, 2015 15:09

Your program is modifying a copy of the environment that it receives from the command processor. To make the change permanent you must change the command processor's environment, see Environment Variables.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 1 guest