Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

MSI does not expand %random% environment variable


1 reply to this topic

frede

frede
  • Full Members
  • 16 posts

Posted 12 April 2011 - 08:05

I am trying to create a log file with a unique name and I want to control the location of the file. I know I can add to the MSI log file by specifying /l +v but this will cause the log file to be very large after the installation has been run more than once. There is an environment variable called %random% that I try to use. It will generate a random number but this does not seem to be recognized by msi.

A simple command like
dir > %SystemDrive%log-%random%.log correctly generates a file like C:\log-23342.log

These are the parameters I pass to msiexec and the resulting file

/l*v %SystemDrive%\log-%random%.log -> C:\log-%random%.log
/l*v %random% -> %random%

As you can see MSI expands the SystemDrive variable fine but ignore %random%
Why is this and is there any way to generate a unique file name with a known location?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 18 April 2011 - 20:11

Not exactly what you are looking for, but this registry entry will create a randomly named log file in the temp folder:
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
"Logging"="voicewarmup"

For more details see http://www.msifaq.com/a/1022.htm