Page 1 of 1

looking for some help of qb/fb commands

Posted: Fri Dec 16, 2011 11:52 am
by palahoot
here is my problem

compile and run this:

#Include "crt/stdlib.bi"
SetEnviron "return=c:\" 'set return equal to c drive
print "return is currently set to "; Environ ("return") 'print the c:\
SetEnviron "return=" + CurDir 'set return equal to current directory path
print "the new return value is ";environ("return") 'print the current directory path
shell("set return=" + curdir)
Shell("setx path ""return;C:\windows""")
Print "setx has now set return to "; Environ("Return")
sleep

after running, check the envvar "return" and see what value it is set to. if you did not preset it, then the value you return after running the program will be nil. if the "return" is valid and set to a folder path, then it will not set it to root or windows upon exit, it will be what it was before you ran the command.

help anyone?

Posted: Fri Dec 16, 2011 1:00 pm
by burger2227
ENVIRON values can only be set while the program is running if at all.

Windows will not retain the value after the program is closed.

Posted: Fri Dec 16, 2011 2:45 pm
by palahoot
burger2227 wrote:ENVIRON values can only be set while the program is running if at all.

Windows will not retain the value after the program is closed.
so there is no other workaround to make this function as expected?

Posted: Fri Dec 16, 2011 2:53 pm
by burger2227
What do you really want to do? I mean what is the point of setting an environmental value in the first place?

The information could easily be stored in a file for later use. Why mess with the environment of somebody else's computer when the computer may not even allow it?

The change would only be temporary and lost when the program ends.

Environmental information is stored by Windows to be READ when you need a certain path or setting. It is really not something to mess with.

Posted: Fri Dec 16, 2011 5:54 pm
by palahoot
was hoping to limit the amount of files needed for this (to mean 0) to run

can do this:
1) via SET
2) via temp file
3) via registry entries

set seemed the simplist so far, but that is not panning out.

working on temp file as we speak

will dabble into regentries as well.

but my other team has come up with a novel solution to the SET command. will investigate that over the weekend and post when i know more.
burger2227 wrote:What do you really want to do? I mean what is the point of setting an environmental value in the first place?
The information could easily be stored in a file for later use. Why mess with the environment of somebody else's computer when the computer may not even allow it?
The change would only be temporary and lost when the program ends.
Environmental information is stored by Windows to be READ when you need a certain path or setting. It is really not something to mess with.