I used to use a reskit to do this but figured it would be faster to not have to make an external call.

function add2path($dir,$type)
; $dir: The directory you want to add to the path
; $type: '1' is local machine path, '0' is user path

if $type
$regpath="hkey_local_machine\system\currentcontrolset\control\session manager\environment"
else
$regpath="hkey_current_user\environment"
endif
$path=readvalue($regpath,"path")
if instr($path,$dir) = 0
if $path=""
$newpath=$dir
else
$newpath=$path+";"+$dir
endif
writevalue($regpath,"path",$newpath,"REG_EXPAND_SZ")
endif
endfunction

[ 28. October 2002, 19:46: Message edited by: Radimus ]