Thanks for all the extra info. I tried using QUIT, but that means that this must be the last required script in the series (or run kix32 again from the calling batch file for any other required scripts). What I ended up with was a GOTO (ugh). Works.

For the enjoyment of all, here's the full script. What we're doing is a mass renaming and describing of workstations, along with setting the workgroup, to clean up browsing. We're a Notes shop (ugh again) and the nicest way I could divine to get an accurate short name and full name for the usual user of the machine was to extract it from the notes.ini.

if exist("c:\kix\namesdone.txt") goto theend endif

charmap

getnotesini

getuserfullname

getusershortname

getnewcomputername

getnewdescription

if @inwin = 1

opentempbat

writeline(1,'net config server /srvcomment:"$newdescription" $enter')
catcherror("Could not edit temp.bat.",@error)

runandkill

else

opentempbat

writeline(1,"c:\reg.exe update hklm\system\currentcontrolset\services\vxd\vnetsup\workgroup=sas $enter")
catcherror("Could not edit temp.bat.",@error)

writeline(1,'c:\reg.exe update hklm\system\currentcontrolset\services\vxd\vnetsup\comment="$newdescription" $enter')
catcherror("Could not edit temp.bat.",@error)

writeline(1,'c:\reg.exe update hklm\system\currentcontrolset\control\computername\computername\computername="$newcomputername" $enter')
catcherror("Could not edit temp.bat.",@error)

runandkill

endif

:theend
exit

;function definitions=========================================================================

function getnotesini

open(1,"c:\lotus\notes\notes.ini",0)
if @error = 0
close(1)
$notesini = "c:\lotus\notes\notes.ini"
else
open(1,"c:\notes\notes.ini",0)
catcherror("Could not find your notes.ini file.",@error)
close(1)
$notesini = "c:\notes\notes.ini"
endif

endfunction
;----------------------------------------
function getuserfullname

$noteslocation = readprofilestring($notesini,"Notes","Location")

$noteslocationarray = split($noteslocation,"/",1)

for each $element in $noteslocationarray
$userfullname = right($element,len($element)-instr($element,"="))
next

if $userfullname = "" $seterror = 1 endif
catcherror("Could not determine userfullname.",@error,$seterror)

endfunction
;----------------------------------------
function getusershortname

$usershortnametemp1 = readprofilestring($notesini,"Notes","KeyFilename")

$usershortnamearray = split($usershortnametemp1,"\")

for each $element in $usershortnamearray
$usershortnametemp2 = $element
next

$thecount = instr($usershortnametemp2,".")
$usershortname = left($usershortnametemp2,$thecount - 1)

if $usershortname = "" $seterror = 1 endif
catcherror("Could not determine usershortname.",@error,$seterror)

endfunction
;----------------------------------------
function getnewcomputername

if $usershortname = @wksta
$newcomputername = trim(@wksta)
else
$newcomputername = trim(left($usershortname+"#"+@wksta,15))
endif

endfunction
;----------------------------------------
function getnewdescription

$newdescription = trim(left(@producttype+"#"+@csd+"#"+$userfullname,48))

endfunction
;----------------------------------------
function opentempbat

open(1,"c:\temp.bat",5)
catcherror("Could not create temp.bat.",@error)

endfunction
;----------------------------------------
function runandkill

close(1)
shell "c:\temp.bat"
catcherror("Could not run temp.bat.",@error)

del(c:\temp.bat)

open(9,"c:\kix\namesdone.txt",5)
catcherror("Could not open semaphore file.",@error)

writeline(9,"This machine's name and description have been updated.")
catcherror("Could not write to semaphore file.",@error)

close(9)

endfunction
;----------------------------------------
function catcherror($errortext, $error, optional $seterror)

if $error <> 0 or $seterror <> 0
open(9,"c:\kix\@wksta.log",5)
writeline(9,"usershortname=$usershortname $enter userfullname=$userfullname $enter noteslocation=$noteslocation $enter notesini=$notesini $enter newdescription=$newdescription $enter newcomputername=$newcomputername $enter errortext=$errortext $enter error=$error $enter seterror=$seterror $enter")
close(9)
messagebox("$errortext Please call the HelpDesk at 555-555-5555.","Script Failure",48)
del(c:\temp.bat)
$error = 0
$seterror = 0
goto theend
endif

endfunction
;----------------------------------------
function charmap

$lf=chr(13)
$cr=chr(10)
$enter=$lf+$cr

endfunction