Anand Murugan
Anand Murugan

Reputation: 223

Delete Command Not working in NSIS?

I want to delete a particlular ear files while running my installer... I have used the following command to delete the files

Delete "${fileLoc}\*.ear"

But this command is not working for me. I dont know the reason... Could you please suggest how to delete particular extension files in NSIS?

Upvotes: 0

Views: 3498

Answers (1)

Seki
Seki

Reputation: 11465

Either the file path is incorrect, or the file cannot be deleted (for various reasons).

  • to check the file path, you can add a

    DetailPrint "delete ${fileLoc}\*.ear"

    to see at run time if it tries to delete the correct files

  • if the path is correct, it may be impossible to delete the file

    • if the file is in currently open / in use by another process, you can try to mark the file as being deleted on the next system starty by using the REBOOTOK parameter for Delete :`

      Delete /REBOOTOK "${fileLoc}\*.ear"

    • because you have a problem with user rights management in a system using UAC (Vista, Win7,...): the current account does not have the right to delete the file (e.g. because it is in a system-protected area like Program files and you need to run elevated (run as administrator) to be able to delete the files

Upvotes: 2

Related Questions