Thanks all, it was the single quotes. Still takes some getting used to how it parses the line... Final code.
Code:
break on
if $ram < 1024
messagebox("Insufficient System RAM","ABORTED",16,10)
exit
endif
$SD=%SystemDrive%
IF Open(1, $SD + "\boot.ini",2) = 0
If exist($SD + "\boot.new")
del '$SD + "\boot.new"' /c /f /h
endif
IF Open(2, $SD + "\boot.new",5) = 0
$IN = readline(1)
While Not @ERROR
if left($IN,5) = "multi" and right($IN,3) = "3gb"
close (2)
close (1)
del $SD + "\boot.new" /c /f /h
messagebox("ALREADY installed","ABORTED",16,10)
exit
else
if left($IN,5) = "multi" and right($IN,3) <> "3gb"
$array = split($IN,'"',-1)
$OUT = WRITELINE (2,$array[0]+'"'+$array[1]+' /3gb"'+$array[2]+' /3gb'+ @CRLF)
$OUT = WRITELINE (2,$IN + @CRLF)
else
if left($IN,8) = "timeout=" $IN = "timeout=10" endif
$OUT = WRITELINE (2,$IN + @CRLF)
endif
$IN = readline(1)
endif
loop
close (2)
close (1)
If exist($SD + "\boot-old.ini")
del $SD + "\boot-old.ini" /c /f /h
endif
$x = SETFILEATTR($SD + "\boot.ini",128)
move $SD + "\boot.ini" $SD + "\boot-old.ini" /h /r
if @error = 0
move $SD + "\boot.new" $SD + "\boot.ini" /h /r
$x = SETFILEATTR($SD + "\boot.ini",7)
$x = SETFILEATTR($SD + "\boot-old.ini",3)
endif
? "=" + $ATTR
messagebox("INSTALLED","3Gb Switch",64,10)
endif
endif