I guess I should cut my losses and move on. At this time I can't redesign the uplevel product to remove the operands from the variable names. Fortunately those names are acceptable in DOS batch. The next time I crack open that code I'll clean the variable names.

You'll see that I've added a trap to catch and ignore variable names which contain operands...my final code looks like this:

Code:
Break on

Color c+/n

$dummy = SetOption('novarsinstrings','on')
;$dummy = SetOption('explicit','on') -- can't use explicit without dimming each $var_name
$dummy = SetOption('wrapateol','on')

If Open(1,'c:\temp\envars.bat') = 0

$raw_line = Trim(SubStr(Lcase(ReadLine(1)),5))

While @error = 0

$var_name = ''
$var_value = ''
$dummy = ''

;provide special handling for ldap path
If InStr($raw_line,'comppath')
For Each $element in Split($raw_line,'comppath' + Chr(61))
$var_name = 'comppath'
$var_value = $element
Next
GoTo set_var
EndIf

For Each $element in Split($raw_line,Chr(61))
Select
Case $var_name = '' $var_name = $element
Case $var_value = '' $var_value = $element
EndSelect
Next

If InStr($var_name,'-')
? $var_name Color r+/n ' $var_name contains operand - skipped' Color c+/n
GoTo next_line
EndIf

:set_var
? '$' + $var_name + '=' + $var_value
If $var_value = ''
Color r+/n "null - skipped" Color c+/n
GoTo next_line
EndIf

$dummy = Execute ("$" + $var_name + "='" + $var_value + "'")

:next_line
$raw_line = Trim(SubStr(Lcase(ReadLine(1)),5))

Loop

Close(1)

EndIf


Thank you, everyone, for your help.

Best regards,

Tim ==