Function XML_Replace Pop $R7 ; section Pop $R4 ; string to replace Pop $R3 ; string to search for Pop $R9 ; file name to patch IfFileExists $R9 0 mmmmm_please_stop GetTempFileName $R8 FileOpen $R1 $R9 "r" FileOpen $R2 $R8 "w" loop_one: ; goes next the section tag FileRead $R1 $R5 IfErrors mmmmm_please_stop FileWrite $R2 $R5 Push $R5 Push $R7 Call StrStr Pop $R6 StrCmp $R6 "" loop_one 0 FileWrite $R2 "$R3$R4" FileWriteByte $R2 "13" FileWriteByte $R2 "10" loop_two: FileRead $R1 $R5 IfErrors done Push $R5 ; read string Push $R3 ; searched string Call StrStr ; we check if string searched is inside Pop $R6 StrCmp $R6 "" 0 lets_turn FileWrite $R2 $R5 lets_turn: Goto loop_two done: ClearErrors FileClose $R2 FileClose $R1 Delete $R9 Rename $R8 $R9 mmmmm_please_stop: FunctionEnd