David Woodhouse <dwmw2 <at> infradead.org> writes: > > On Fri, 2015-01-30 at 08:31 -0500, Steven Petraglia wrote: > > > > ::-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > :: Windows7 Run From Current Dir > > ::-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > pushd %~dp0 > > > > set VERBOSE=-v > > > > set CISCO_SPLIT_INC=2 > > set CISCO_SPLIT_INC_0_ADDR = "20.137.0.0" > > set CISCO_SPLIT_INC_0_MASK = "255.255.0.0" > > set CISCO_SPLIT_INC_0_MASKLEN = "32" > > set CISCO_SPLIT_INC_1_ADDR = "170.225.31.0" > > set CISCO_SPLIT_INC_1_MASK = "255.255.255.0" > > set CISCO_SPLIT_INC_1_MASKLEN = "32" > > > > "openconnect.exe" %VERBOSE% client.com > > Hah, so *this* is why OpenConnect was crashing. It tries to set these > environment variables according to what the server tells us, and the bug > triggered when it found them already set (I'd coded it to delete > existing conflicting variables from the environment but evidently not > tested it very well). > > You need to interpose your script between openconnect and > vpnc-script-win.js, not run it before openconnect. > > So run openconnect with '--script routehack.bat', and change > routehack.bat so that it sets those variables and then invokes > vpnc-script-win.js. > > Although I think openconnect expects its script to be run with > 'cscript.exe' so perhaps it needs to be JavaScript instead of a batch > file. At the top of vpnc-script-win.js, one can add the following to set those variables from within cscript (confirmed to work): var oShell = WScript.CreateObject("WScript.Shell"); var oEnv = oShell.Environment("PROCESS"); oEnv("TEST1") = "TEST_VALUE"; oEnv("CISCO_SPLIT_INC_0_ADDR")="10.0.0.0"; oEnv("CISCO_SPLIT_INC_0_MASK")="255.0.0.0"; ... oEnv("CISCO_SPLIT_INC")="2"; Cheers, V.