(3) If you can't give specific reasons for lines like "Set xxx = Nothing" they are not needed (and "Set fso = Nothing" would be fatal in regard to (2))
I need to read Line 6 of the Output , whether an Error Occured. Is it possible to do that without opening it again? To read it after writing? I need to look whether the Output Contains : " Result: The task completed with an exit code of (0)."... Could you help me again? I don't get it -.-
your first attempt: assigning something to oMTS( 1 ).Value makes no sense; you want to check if it contains "code of (0)".
your second attempt: oMTS( 1 ).Value may well contain this exit code line, but not two further lines as you requested with the pattern
oRE1.Pattern = "^((.*exit code of (0).*))$\n^.*$\n^.*$"
The best/simplest way is to look for "code of (0)" just after writing:
Else oTS.WriteLine oMTS( 0 ).Value oTS.WriteLine oMTS( 1 ).Value If 0 < Instr( oMTS( 1 ).Value, "code of (0)" ) Then WScript.Echo "no error" Else WScript.Echo "no no error" End If End If