Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: setting environment variables

From: greggirwin:mindspring at: 29-Aug-2002 17:25

Hi Scott, << Is there a way in REBOL/Core to set an environment variable? I want to set TZ so I can easily get the time and date of various places around the world. >> Not in Core. With Command or View/Pro, I just whacked this up. lib: load/library %msvcrt.dll get-env: make routine! [ varname [string!] return: [string!] ] lib "getenv" put-env: make routine! [ env-string [string!] return: [integer!] ] lib "_putenv" remove-env-var: func [name [string!]] [put-env join name "="] tz-set: make routine! [ return: [integer!] ] lib "_tzset" print get-env "path" print get-env "lib" print get-env "temp" print get-env "test" if 0 <> put-env "test=blah" [ print "error writing environment variable" ] print get-env "test" print get-env "TZ" tz-set free lib halt HTH! --Gregg