Code:

Function Test
$filename = 'C:\xfer.txt'
$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
$Write = WriteFile('C:\xfer2.txt',$line)
EndFunction



When using the above test function, it only creates a blank file. I'm at a loss as to why it's not working.


Edited by dataspike (2006-02-22 08:50 PM)