Jump to content

Recommended Posts

Posted

CopyFiles

[install-section-name]

CopyFiles=file-list-section

[file-list-section]

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.

destination-file-name

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

source-file-name

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

temporary-file-name

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.

flag

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

[DefaultInstall]
CopyFiles = CopyTheseFilesSec

[DestintaionDirs]
CopyTheseFilesSec = 16422,"Files"

[CopyTheseFilesSec]
newname.txt,oldname.txt;<-This renames "oldname.txt" to "newname.txt" during copy
executable.exe
helpfile.hlp

=====================================================================

CoyFiles and a "Single" file

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

CopyFiles=Section.Name

[DestinationDirs]
Section.Name=ldid(,subdir)

[Section.Name]
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.)

[DefaultInstall]
CopyFiles=@USDownld.inf

[DestinationDirs]
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.

CopyFiles=@filename.ext

In [DestinationDirs] you add a DefaultDestDir

[DestinationDirs]
DefaultDestDir=ldid(,subdir)

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:

CopyFiles=FileSection1,@myfile.txt,@anotherfile.txt,LastSectionName

[DestinationDirs]

FileSection1=ldid(, subdir)

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

LastSectionName=ldid(, subdir)

Source: INF_DOC

Part-4

Join the conversation

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

Guest
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.

×
×
  • Create New...