looking for some help of qb/fb commands

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

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

looking for some help of qb/fb commands

Postby palahoot » Fri Dec 16, 2011 11:52 am

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: 2143
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Postby burger2227 » Fri Dec 16, 2011 1:00 pm

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 : http://www.QB64.NET
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

Postby palahoot » Fri Dec 16, 2011 2:45 pm

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: 2143
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Postby burger2227 » Fri Dec 16, 2011 2:53 pm

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 : http://www.QB64.NET
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

Postby palahoot » Fri Dec 16, 2011 5:54 pm

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.


Return to “Freebasic Questions & Answers”

Who is online

Users browsing this forum: No registered users and 2 guests

cron