[Files] Source: ..\SQL\CreateDatabase.bat; DestDir: {tmp}; Flags: deleteafterinstall;Note deleteafterinstall flag, it indicates the file will be deleted at the end of installation when it won’t be necessary any longer.
The second part is to launch this file at the end of installation process (of course, this takes place before deleting of the files, Inno Setup handles this correctly automatically):
[Run] Filename: {tmp}\CreateDatabase.bat; Flags: runhidden;Note runhidden flag here, it indicates that this operation won’t be visible for users of your installer. This flag can be removed if you prefer to leave this operation noticeable.
When your application is uninstalled, you may need also to launch a file. In our example, we need to delete database.
[UninstallRun] Filename: {app}\Scripts\DeleteDatabase.bat; Flags: runhidden;We are using the same flag runhidden, but now we can’t use temporary directory, we need to run from application directory or from some folder like commonappdata. The file needed for deleting database was created during process of installation in [Files] section:
[Files] Source: ..\SQL\DeleteDatabase.bat; DestDir: {app}\Scripts;
No comments:
Post a Comment