Skip to content
⌘ NSIS Forum Archive

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

4 posts

nsispysn#

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?