I have a program that I want to set two environment variables, then come out to the console/prompt (exit) and have those persist for use in a batch file... however this is not happening.
Code: Select all
IF RunMode = "B" THEN
ReturnCode = 0
ReturnCode = SETENVIRON( "CMOSPATH=" & SavePath )
ReturnCode = SETENVIRON( "CMOSNAME=" & SysName & ".SAV" )
IF ReturnCode = 0 THEN
PRINT " The environment variable CMOSPATH is: "
PRINT TAB(8); ENVIRON( "CMOSPATH" )
PRINT " The environment variable CMOSNAME is: "
PRINT TAB(8); ENVIRON( "CMOSNAME" )
PRINT "These may not exist yet! You may need to create the folder"
QUIT(0, Verbosity, BeginDir)
PRINT "Unable to create environment variables"
QUIT(15, Verbosity, BeginDir)
The above code is a snippet - the program compiles, and I see what is expected on screen when this code is executed, but when the program exits to the prompt...
- "SET" shows the environment variables that existed before running the program and not the two new ones.
Setting the two variables to something
Running the program,
Issuing the "SET" command
... shows that they were not modified.
In the code, I set two environment variables - and then read them back out of the environment - and they show up fine?!