See readfile() and writefile() UDFs
$sOldString1="%" + "windir" + "%"
$newstring = '%systemdrive%'+split('%windir%',':')[1]

$file=readfile($filename)
for each $line in $file
if instr($line,$sOldString1)
$line = join(split($line,$sOldString1),$newstring)
endif
next
$nul=writefile($filename)
_________________________
How to ask questions the smart way <-----------> Before you ask