MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: /FileComment[Next]: FilesExclude
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->Files

The "Files" Command

This command adds all files that match the file mask(s) you supply. This command can include all or parts of a whole directory tree and can also be supplied a list of files or filemasks to process.

The "File" command adds a single file at a time (and allows "renaming"). Also have a look at the "Create Macro For Adding Files" tip for an example of one way of simplifying file addition.

If you are adding a large number of files and this is a bit slow then you should have a look at the performance section!

If MAKEMSI has problems and ignores (or doesn't find) files whose names or directories contain "international" characters then please see the documentation for the "MAKEMSI_MM_CODEPAGE" environment variable.

With the default MSI schema it can have a maximum of 32,767 files, however MAKEMSI will take a while to create this MSI and Windows Installer will be very slow to install and uninstall it. If you have large numbers of files I recommend you read the "performance" and "TABLES_FILE_SEQ_NUMBER_LIMIT" sections of this manual!

I recommend that you read the "Resource Life Cycle" section.

The command takes these parameters:

Main File Related Options

Please see the "options for commands" section of the manual.

#define? DEFAULT_FILE_WANT_FILEHASH                  T         ;;Generate MD5 (Y=YES, N=NO, T=TRY). MD5 needs Windows Installer 2.0+
#define? DEFAULT_FILE_ATTRIBUTES                     Vital     ;;Only use if user did not supply
#define? DEFAULT_FILE_ATTRIBUTES_TO_COPY                       ;;Choose one or more from hidden/system/readonly
#define? DEFAULT_FILE_LANG_WHEN_GETLANGUAGE_FAILS    1033      ;;Can be ""
#define? DEFAULT_FILE_ACCESS
#define? DEFAULT_FILE_REMOVE                         N         ;;Don't remove files by default!
#define? DEFAULT_FILE_DATE                                     ;;""= file date or date in "YYYY-MM-DD" (exactly 10 characters)
#define? DEFAULT_FILE_TIME                                     ;;""= file time or time in "HH:mm:SS"   (exactly 8 characters and seconds even)
#define? DEFAULT_FILE_DOCO                           Y         ;;"N" = Don't add to doco (by default)
#define? DEFAULT_FILE_OPTIONS4COMPONENT                        ;;Any options for autocreated components
#define? DEFAULT_FILE_OPTION_MAKE_REMOVE_DIRECTORIES Y         ;;Now make/remove directories by default
#define? FILE_HTMLRPT_INSTALLTIME_COMMENT_TEXT          *          ;;What the user sees
#define? FILE_HTMLRPT_INSTALLTIME_COMMENT_HTML          <span title='The install time of the file will be &quot;{?}&quot;'><font color=red><$FILE_HTMLRPT_INSTALLTIME_COMMENT_TEXT></font></span>     ;;Don't use Double quotes and ONLY the text in the "FILE_HTMLRPT_INSTALLTIME_COMMENT_TEXT" macro should be visible to user (or sorting won't work correctly)!!!
#define? FILE_GENERATED_COMPONENT_PREFIX                c          ;;Begins any components generated by the "file(s)" commands, followed by unique number ("" means don't add unique prefix)
#define? FILE_GENERATED_COMPONENT_USE_FILE_AS_KEYPATH   Y          ;;Must be "Y" unless you have set a keypath in the "Options4Component" parameter (in which case should be "N")!
#define? FILE_GENERATED_COMPONENT_MAX_LENGTH            <$TABLES_LNG_COMPONENT_COLUMN>  ;;Should be shorter than or equal to value in "TABLES_LNG_COMPONENT_COLUMN" (see doco for error code 2716)
#( ';'
   ;--- Semi colon (";") delimitered list of file extensions ----------------
   #define? FILE_EXTENSIONS_WHICH_NEED_OWN_COMPONENT    ;;"*" means all
   .exe
   .dll
   .ocx
   .hlp
   .chm
#)
#define? FILE_COMMAND_ALLOWED                                      ;;If not blank then not allowed and is the error message. You can use "{NL}" to represent newlines
#define? FILE_VERSION_FOR_UNVERSIONED_FILES
#define? DEFAULT_FILE_ROWKEY_CASE                                  ;;Can be "" or "L" or "U"
#define? DEFAULT_FILE_ROWKEY_MAXLNG               <$TABLES_LNG_FILE_COLUMN>-4   ;;0 = no restriction (this limit is WITHOUT any possible number added to make unique!)
#define? FILE_HTMLRPT_HR                          <$SUNDRY_HTMLRPT_HR>
#define? FILE_HTMLRPT_ROWKEY                      MAKEMSI_Documentation     ;;Name of special case which does not exist when code generated!
#define? FILE_HTMLRPT_MAX_EXTENSION_WIDTH         7
#define? FILE_STYLE_TEXT_ERROR                    color:red
#define? FILE_STYLE_TEXT_OK                       color:green
#define? FILE_VERIFY_STYLE_FILENAME_DEFAULT_LOCN  color:blue
#define? FILE_VERIFY_OUTPUT_BACKGROUND_COLOR      #dfdfdf
#define? FILE_VERIFY_SHOW_COMPONENT_OK_MESSAGE_WHEN_FILES_ALSO_OK N
#define? FILE_VERIFY_ATTRIBUTE_SET.H              <b>H</b>
#define? FILE_VERIFY_ATTRIBUTE_SET.R              <b>R</b>
#define? FILE_VERIFY_ATTRIBUTE_SET.S              <b>S</b>
#define? FILE_VERIFY_ATTRIBUTE_RESET.H            h
#define? FILE_VERIFY_ATTRIBUTE_RESET.R            r
#define? FILE_VERIFY_ATTRIBUTE_RESET.S            s

#( '<?NewLine>'
   #define? FILE_STYLES

   .FileCmtPlus             {font-size:9pt;}
   .FileCmtName             {<$HTMLRPT_STYLE_VALUES_KEY>}
   .FileCmtValue            {<$HTMLRPT_STYLE_VALUES_VALUE>}
   .FileCmtSFI              {color:maroon}
   <$FILE_STYLES_VERIFY>
   <$FILE_STYLES_VERIFY_COMPONENT_CHECKS>
#)
#( '<?NewLine>'
   #define? FILE_STYLES_VERIFY

   .FileVerify_DoesNotExist    {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerify_FileNameDefault {<$FILE_VERIFY_STYLE_FILENAME_DEFAULT_LOCN>}
   .FileVerify_CantAccess   {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerify_OK           {<$FILE_STYLE_TEXT_OK>}
   .FileVerify_MisMatch     {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerifyNoActiveX     {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerifyProductErr    {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerifyProductOK     {<$FILE_STYLE_TEXT_OK>}
#)
#( '<?NewLine>'
   #define? FILE_STYLES_VERIFY_COMPONENT_CHECKS

   .FileVerify_ComponentUnmanaged                      {}
   .FileVerify_ComponentNotInstalledAndFileDoesntExist {<$FILE_STYLE_TEXT_OK>}
   .FileVerify_ComponentInstalledAndFileOk             {<$FILE_STYLE_TEXT_OK>}
   .FileVerify_GuidUnknown                             {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerify_ComponentNotInstalledButFileOk          {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerify_ComponentNotInstalledAndFileDoesntMatch {<$FILE_STYLE_TEXT_ERROR>}
   .FileVerify_ComponentInstalledButFileDoesntMatch    {<$FILE_STYLE_TEXT_ERROR>}
#)

EXAMPLES

;--- Add files to a specific component ---
<$Component "MainFiles" Create="Y" Directory_="INSTALLDIR">
   ;--- Add ".MMH" (header) files ---
   <$FilesExclude "SelfReg*.mmh" EXLIST="NotThese">   ;;Don't include these!
   <$Files        "*.mmh"        EXLIST="NotThese">
<$/Component>

;--- Now add a whole directory tree automatically creating components ---
<$Files 'c:\SourceTree\*.*' SubDir='TREE' DestDir='INSTALLDIR'>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: /FileComment[Next]: FilesExclude


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.