Date and time in installer or application name

From NSIS Wiki
Jump to navigationJump to search

Description

This simple snippets will allow you to have installer names like Install-2006-06-17-00-30-00.exe. or 1.0.20060617003000__setupAppName.exe

Great for backups.

The Script

!define /date MyTIMESTAMP "%Y-%m-%d-%H-%M-%S"
 
Name "MyApplicationName ${MyTIMESTAMP}"
 
OutFile "MyApplicationNameSetup-${MyTIMESTAMP}.exe"

You can add also an application version with timestamp as the name of the setup.exe

!define VERSION 1.0
!define /date MYTIMESTAMP "%Y%m%d%H%M%S"
 
Name "MyApplicationName"
 
OutFile "${VERSION}.${MYTIMESTAMP}.setup_MyApplicationName.exe"
 
Section
;CREATE BACKUP OF THE EXISTING SITE IF THERE EXIST ANY FOLDER INSTALLED ALREADY
Rename "$INSTDIR" "$INSTDIR.${VERSION}.${MYTIMESTAMP}"
 
 
SectionEnd