well, you are not showing what is $task

anyway, this:
Code:
          IF @ERROR <> 0
	       $RC = REDIRECTOUTPUT (failure.txt, 0)
	       ? $Element
	  Else if @ERROR = 0
	        $RC = REDIRECTOUTPUT (success.txt, 0)
	       ? $Element
	  Endif Endif

is same as:
Code:
          IF @ERROR <> 0
	       $RC = REDIRECTOUTPUT (failure.txt, 0)
	       ? $Element
	  Else
	        $RC = REDIRECTOUTPUT (success.txt, 0)
	       ? $Element
	  Endif
_________________________
!

download KiXnet