Self copy install ?
Is there a way to make the install file copy itself after installation into the install dir ?
13 posts
Function .onInstSuccess
CopyFiles /SILENT "$EXEDIR\Setup.exe" "$INSTDIR\Setup.exe"
FunctionEnd
After this call $R0 will be equal to full path of file (i.e. path and file-name). Parse this variable.
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
Add:
Function .onInstSuccess
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
StrLen $0 $R0
Push $R0
Call GetParent
Pop $1
StrLen $1 $1
IntOp $0 $0 - $1
IntOp $0 $0 - 1
StrCpy $R1 $R0 "" "-$0"
CopyFiles /SILENT "$R0" "$INSTDIR\$R1"
FunctionEnd
Edit: Silent may not be wise if the installer is large.Function .onInstSuccess
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
Push $R0
Call GetFileName
Pop $R1
CopyFiles "$R0" "$INSTDIR\$R1"
FunctionEnd
Fully-qualified path names should always be used with this instruction. Using relative paths will have unpredictable results.