Jump to content
Sign in to follow this  

[Tutorial] INF Part-3 "CopyFiles"

Recommended Posts





destination-file1-name(, source-file1-name)(, temporary-file1-name)(,flag)

destination-file2-name(, source-file2-name)(, temporary-file2-name)(,flag)

A list of the names of files to be copied from a source disk to a destination directory. The source disk and destination directory associated with each file are specified in other sections of the INF file. The file-list-section name must appear in the CopyFiles item of an Install section.


Name of the destination file. If no source filename is given, this is also the name of the source file.


Name of the source file. If the source and destination filenames for the file copy operation are the same, this is not required.


Name of a temporary file for the file copy operation. The installer copies the source file but gives it the temporary file name. The next time the operating system starts, it renames the temporary file to the destination file name. This is useful for copying files to a destination which is currently open or in use by Windows.

If the file is not in use by Windows, use flag 8 to force it to use the temporary name. This will only work if the file already exists in in the target folder. To get around this, first copy the file into the folder, then use flag 8 to copy it again.


Optional parameter used to perform special actions during the installation process. Multiple flags can be used by adding the values to create the combined flag. The following valid flags can be used:

Value Meaning

1 On CopyFiles: Warn if user tries to skip file.

1 On DelFiles: If file is in use, queue up delayed delete in wininit.ini. Otherwise an in-use file will not be deleted.

2 Setup Critical: don't allow user to skip file.

4 Ignore version check and always copy file. This will overwrite a newer file.

8 Force Rename (trick engine into thinking that file is in use). Note: Only happens if file already exists on target.

16 If file already exists on target, don't copy.

32 Suppress version conflict dialog and don't overwrite newer files.

You also must define the destination directory for each CopyFiles section using the DestinationDirs section.

This example copies three files to %ProgramFiles%\Files

CopyFiles = CopyTheseFilesSec

CopyTheseFilesSec = 16422,"Files"

newname.txt,oldname.txt;<-This renames "oldname.txt" to "newname.txt" during copy


CoyFiles and a "Single" file

If you are using CopyFiles in your INF to copy a single file you probably use something like this.



singlefile.ext;<-This is a section only has single file, we don't need it

Here is another way (I will be using a example that copies my INF to the %WinDir%\inf directory for uninstall.)


DefaultDestDir=17;<-This sets the default destination dir of the file/s with the "@" symbol

Its really quite simple, in CopyFiles you add the "@" symbol followed by the filename and extention.


In [DestinationDirs] you add a DefaultDestDir


Note that you can specify the copying of a single file in the CopyFiles item of the Install section itself, without building a CopyFiles section. To do this, use the special character "@" to force a single file copy. An example of using the "@" character in a CopyFiles-type item is in the Install section reference topic. Copying a single file in this way is somewhat limited because the source and destination filenames must be the same in this case and you cannot use a temporary file.

The following example shows how to copy individual files:



FileSection1=ldid(, subdir)

DefaultDestDir=ldid(, subdir) ;<-This is where the files get copied

LastSectionName=ldid(, subdir)

Source: INF_DOC


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...