looking for some help of qb/fb commands

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

Post Reply
palahoot
Newbie
Posts: 3
Joined: Fri Dec 16, 2011 11:25 am

looking for some help of qb/fb commands

Post 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?
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
palahoot
Newbie
Posts: 3
Joined: Fri Dec 16, 2011 11:25 am

Post 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?
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
palahoot
Newbie
Posts: 3
Joined: Fri Dec 16, 2011 11:25 am

Post 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.
Post Reply