Directory Property

Return or set the installation directory for the file.

Syntax

object.Directory [= value]

The Directory property syntax has the following parts:

Part Description
object An object expression that evaluates to a PackageFile object.
value A string which specifies the installation directory for the file in the package.

Remarks

The Directory property can be used to determine the directory where the file will be installed, or change the installation directory for the specified file. Although it is possible to specify an absolute directory path, this is not recommended. Either a relative path, where the file will be updated relative to the default installation directory, or a folder macro should be used.

The installation directory may include special strings which are expanded when the package is applied. Any value enclosed in percent (%) symbols is considered to be an environment variable and is replaced with the value of that variable. For example, if the installation directory is the string "%TEMP%", this would be replaced with the value of the TEMP environment variable, such as "C:\TEMP".

Any value enclosed in brackets (either [] or <>) is considered to be a folder macro, a value which represents a special folder on the local system. The following values are defined:

COMMONFILES
The default directory in which shared program files are installed (i.e.: "C:\Program Files\Common Files")

FOLDER_DESKTOP
The directory where files are stored that are located on the shell desktop.

FOLDER_STARTMENU
The directory where files are stored that are located in the current user's Start folder.

FOLDER_STARTUP
The directory where files are stored which are executed when the current user logs in to the system.

INSTALLDIR
The default installation directory for this package as specified when the package is applied.

INSTALLDISK
The disk on which the default installation directory is located. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

PERSONALFILES
The default directory in which documents for the current user are created.

PROGRAMFILES
The default directory in which programs are installed (i.e.: "C:\Program Files")

TEMPDIR
The directory in which temporary files are created. This directory is typically defined by the TEMP or TMP environment variables.

TEMPDISK
The disk on which temporary files are created. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

WINDIR
The directory in which the Windows operating system was installed (i.e.: "C:\WINDOWS").

WINDISK
The disk on which the Windows operating system was installed. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

WINSYSDIR
The directory in which the Windows libraries, drivers and other system files were installed (i.e.: "C:\WINDOWS\SYSTEM" or "C:\WINNT\SYSTEM32")

WINSYSDIR16
The directory in which 16-bit Windows system files are installed (i.e.: "C:\WINDOWS\SYSTEM" or "C:\WINNT\SYSTEM")

WINSYSDISK
The disk on which the Windows operating system files were installed. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

In addition to these predefined macros, the installation directory may also use macros which reference a registry entry or a value in an initialization file. As with folder macros, they are enclosed in brackets and have the following formats:

[root:key] or [root:key,value]

This is used for registry values, where root may be one of the following root key names: HKCR, HKCU, HKLM or HKCC. The key specifies the key under the specified root, and the optional value specifies a value for that key. If no value is provided then the default key value is used. An example would be [HKLM:Software\Microsoft\Windows\CurrentVersion,MediaPath]

[filename:section,key]

This is used for initialization files, where filename is the name of the file (if no path is provided, it will search for the file using the standard Windows pathing rules; if no extension is specified, a default extension of ".ini" is used). The section and key values refer to the section and key name in the file. An example would be [win.ini:msapps,msinfo]

To determine the local directory where the file would be installed on the current system, use the LocalDirectory property.

Example

'
' Change all text files in the DOC subdirectory to be created
' or updated in the subdirectory called TEXT under the
' default installation directory on the target system
'
Dim Files As PackageFiles
Dim File As PackageFile

Set Files = Package1.Find("doc\*.txt")
For Each File In Files
    File.Directory = "<INSTALLDIR>\TEXT"
Next
Set Files = Nothing

See Also

LocalDirectory Property