How to set Windows environment variable from Tcl script -


i have tcl script generates value store in windows environment variable. know cannot done directly within script.

what planning output value stderr:

puts stderr $var 

how use stderr channel set environment variable in calling batch file?

is there more convenient way set environment variable tcl script?

the easiest way use tcl script write batch file known name contains environment variable setting, env.bat:

set f [open env.bat w] puts $f "set foo=bar" close $f 

then can make real batch file call environment variable definition it:

call env.bat 

this method going easiest make work in way non-surprising. it's going pretty easy debug, since can @ env.bat in text editor , figure out if things in sensible. (i'm assuming run in same directory , code has permission write there; that's definitely easiest way it. it's possible write temporary file somewhere else , pass name around, that's rather more complex make function correctly.)


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -