Archive: dynamically naming the outfile (*.exe)


dynamically naming the outfile (*.exe)
Good evening,

I'm new in NSIS so please be kind if it's something quite obvious or trivial but:
I wanted to name the outfile dynamically and make it somewhat like "2009_sep_07_14_13.exe" so you can read more easily when the .exe was compiled.
The problem: As I try to name my .exe via:
<code>Outfile $filename</code>
it names the output-file exactly "$filename" instead what this variable is standing for.
I've tried several quotations but nothing seems to work.

Any suggestions how to solve or at least work-around this problem? At very least it would be enough to name the file with a spelled 3-sign-month (jan, feb, mar, ...)

Thanks for any info,

best regards - Marcus


$xxx is a variable, and those only work at run time

try ${__DATE__} ${__TIME__}
or ${__TIMESTAMP__}


Here's the code that I use:

; Define your application name
!define APPNAME "Utilities"
!define /date DATE "%Y.%m.%d"
!define APPNAMEANDVERSION "Utilities ${DATE}"

; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Utilities"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "Installers\${APPNAMEANDVERSION}.exe"


Not sure if this will help, but if you read the Helpfile for the DATE options, you should find something that you can use.

Thanks for first help but the Problem is that ${__DATE__) only provides pure numerical information. So I would end up with something like 2009_09_07_13_13 ... and hell - I even won't try to read this ^^
So the task is to get a letter into - replacing is no problem but putting the build string into the outfile-name is the issue I'm going down on.

I read somewhere around here that outfile needs compile-time-information whereas ${__DATE__) and so forth are exceptions from this rule. Anoybody who can approve this?


${xxx} are defines, and they are defined at compile time


So it looks like there is no chance renaming the outfile with runtime-information?
Hm.. any work-around suggestions? Could I perhaps rename the .exe after building it using NSIS?


...what? Outfile is a compile-time command. Runtime information has nothing to do with the filename of your installer. You don't want to change the name of your installer.exe after the user has downloaded and run it, do you? o___O


Ah, no no - of course not^^
At creating the installer (not using it!) i want to name the .exe like I described because I'll have several versions of this and want to keep track of when they were created this way.


Well, that's what the DATE define is for. I don't think there's a compile command that does what StrCpy does, so if you want it in text you'll have to use renaming or other hackjob methods. You can use !system to run a bat file or exe file of your choosing.
http://nsis.sourceforge.net/Docs/Chapter5.html#5.1.11

(If you're not familiar with programming languages, one ugly way to create that exe is to write an NSIS "installer" that takes a filename from its command line and renames it to the current date in your preferred format.)


Thanks for your help everyone. I'll try it as MSG said (while this method has the problem that I'd need another file to retreive this information from) or rename it by a wrapping project.

Thanks again for your very fast and helpful answers!
(So at least I won't try to set the Outfile-property with runtime-information and you guys helped me saving a lot of time^^)

Kind regards and good luck to your projects,

Marcus