File Object

InstallShield 2015 » Object Expressions for Advanced UI and Suite/Advanced UI Projects

To create an object expression that checks target systems for information about a file during an Advanced UI or Suite/Advanced UI installation, use the File object. The File object has support for properties such as Date and Version.

Syntax

[@File(FilePath,64Bit).Content]

[@File(FilePath,64Bit).Date(Parameter)]

[@File(FilePath,64Bit).Version]

Parameters

The following parameters are available for the File object.

Parameters for the File Object

Parameter

Description

FilePath

Specify the path to the file. You can use property directory identifiers such as [ProgramFilesFolder].

64Bit

Use this optional Boolean parameter to indicate whether the file is in a 64-bit location, such as in the System32 folder on a 64-bit system. Valid options are:

true—Check the 64-bit location.
false—Check the 32-bit location.

If you omit this property, or if or the target system is running a 32-version of Windows, the installation checks the 32-bit location.

Properties

The following properties are available for the File object.

Properties for the File Object

Property

Description

Content

If the file is a text file (for example, .txt, .htm, .xml, .config, .ini, or .sql), retrieves the contents of the file.

Date

Retrieves the date and time for the file. Optional parameters that are available for this property are:

modified—Retrieves the date and time at which the file was last modified. This is the default parameter.
access—Retrieves the date and time at which the file was last accessed.
create—Retrieves the date and time at which the file was created.

If you omit a parameter for the Date property, the File object returns the last-modified date.

Version

Retrieves the version of the file. For an unversioned file, this property returns empty.

Examples

The following examples demonstrate use of the File object in object expressions

Sample File Object Expressions

Expression

Description

[@File([ProgramFilesFolder]MyCompany\
MyProduct.exe,false).Date(modified)]

Obtain the last modified date and time for a file called MyProduct.exe.

On 32-bit target systems, the path may be this:

C:\Program Files\MyCompany\MyProduct.exe

On 64-bit target systems, the path may be this:

C:\Program Files (x86)\MyCompany\MyProduct.exe

[@File([SystemFolder]notepad.exe).Version]

Obtain the version number of notepad.exe in the System32 folder on 32-bit target systems or in the SysWOW64 folder on 64-bit target systems.

[@File([SystemFolder]notepad.exe,true).Version]

Obtain the version number of notepad.exe in the System32 folder on 32-bit and 64-bit target systems.

See Also