Archive: File is actually opened,but error flag is still set.Why?


File is actually opened,but error flag is still set.Why?
i use the following to open and write a file:

ClearErrors
FileOpen $regbat $INSTDIR\reg.bat w
IfErrors OpenRegBatError
FileWrite $regbat "cd /d $INSTDIR $\r$\nregsvr32 -s WebClient.ocx"
FileClose $regbat

ExecShell "" '"$INSTDIR\reg.bat"' "" SW_HIDE
OpenRegBatError:
MessageBox MB_ABORTRETRYIGNORE "Fail to write reg.bat!" IDABORT _abort IDRETRY retry


The result wass:reg.bat was successfully written but the MessageBox displayed too.

Why?


i've found the reason.


Could you share? so others don't fall in the same problem


Edit: Nevermind, I see what you're trying to do there.