We are working on converting the wiki to a static website controlled by markdown files in https://github.com/nsis-community. You can already see there how plug-ins will be posted. The end-user interface will still be a website but with a fresh coat of paint. Come meet us at Discord to talk about it.
Install on reboot
From NSIS Wiki
Jump to navigationJump to search
| Author: Afrow UK (talk, contrib) |
Description
This macro can be used to install a file on reboot if the file is in use at time of installation.
Macro(s)
!macro InstallOnReboot Source Destination SetFileAttributes `${Destination}` NORMAL File `/oname=${Destination}.new` `${Source}` Delete /rebootok `${Destination}` Rename /rebootok `${Destination}.new` `${Destination}` !macroend !define InstallOnReboot `!insertmacro InstallOnReboot` !macro DeleteOnReboot Path IfFileExists `${Path}` 0 +3 SetFileAttributes `${Path}` NORMAL Delete /rebootok `${Path}` !macroend !define DeleteOnReboot `!insertmacro DeleteOnReboot`
Note the resetting of a files' attributes. Windows can fail to perform an operation if a file has HIDDEN+SYSTEM set.
Usage
${InstallOnReboot} some_file.exe $INSTDIR\some_locked_file.exe
${DeleteOnReboot} $INSTDIR\some_locked_file.exe
Stu