Install on reboot: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (→Usage) |
|||
Line 23: | Line 23: | ||
!define DeleteOnReboot `!insertmacro DeleteOnReboot` | !define DeleteOnReboot `!insertmacro DeleteOnReboot` | ||
</highlight-nsis> | </highlight-nsis> | ||
Note the resetting of a files' attributes. Windows can fail to perform an operation if a file has HIDDEN+SYSTEM set. | |||
== Usage == | == Usage == |
Latest revision as of 10:25, 22 July 2009
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