Archive: How to delete the text file in nsis


How to delete the text file in nsis
Hi All,

I am try to delete file using nsis script that file is create by java class it is not able to delete can any one help.

ExecWait '"$INSTDIR\Jasypt.bat" "$db_password_state" "$INSTDIR\jre6\pass.txt"' // Executing batch file using the path and get encrypted password in pass.txt file

FileOpen $4 "$INSTDIR\jre6\pass.txt" r // reading the file pass.txt
FileRead $4 $db_password // reading one line and keeping in another variable

Delete "$INSTDIR\jre6\jasypt-1.7.jar" // deleting jar file [it is deleting]

Push $db_password # replace the encrypted password
Push all #replace all occurrences
Push all #replace all occurrences
Push "$INSTDIR\conf\server.properties" #file to replace in
Delete "$INSTDIR\jre6\pass.txt" // deleting the pass.txt file [but it is not deleting]

Thanks in advance.


I got the answer. I did not close the resource after opening file
FileClose $4 so it cannot delete the file