- No need to install Tcl separately
- No DOS box appearing
set ::env(MYVAR) "Whatever" lappend ::env(PATH) "c:/myprogramdir" exec myprog.exe &When the exec command completes, the script is ended and so is Tclkit. But my program is running ...MHo: This is because the newly executed myprog.exe inherits the environment table from its parent process. P.S.: You don't have to struggle with windows dialogs to manipulate the environment permanently; take a look at the setx.exe-Utility from the resource-kit.
More on this subject appears in, for example, "Setting environment variables with a script", and the remarks here [1] by GWL and Ralf Fassel.
tombert - 2016-04-27 12:34:31If one does not want to add a static library search path to the PATH environment variable, based on the above restart approach one can also do the following. Check on which platform you are running: windows, 32 bit or 64 bit. Create the additional library path to search for (in the example below it is in the share/lib32 or share/lib64 sub-path of the executable). If the path is not found in the current PATH environment restart the whole script.I build this code because of dependency issues with my tdbc::postgres compilation. In the lib32 and lib64 path I put the libpq, libintl-8 ... libs.
## add lib32/lib64 library search path to environment if {$tcl_platform(platform) == "windows"} { if {$tcl_platform(pointerSize) == 4} { set libPath [file join [file dirname [file dirname [info nameofexecutable]]] share lib32] } else { set libPath [file join [file dirname [file dirname [info nameofexecutable]]] share lib64] } set found 0 foreach path [split $::env(PATH) ";"] { set path [file normalize $path] if {$path == $libPath} {set found 1} } if {!$found} { append ::env(PATH) ";[file nativename $libPath]" exec [info nameofexecutable] [info script] & exit } }