大网数据广告活动
安装更新与部署

Searching for a Directory and a File in the Directory

· 52CE 我爱测

During a Windows Installer installation, the installer can search for a directory and a file in that directory.

To search for a directory and then a file in that directory

  1. First search for the directory.

    AppDir must be defined as the valid signature of the directory. If AppDir is not defined as a valid signature, AppSearch does not have a place to find the file, for example, if the search is for c:\MyDir\MyApp.exe, AppDir should be defined as c:\MyDir. AppDir might be defined by including a record in the DrLocator Table, or by some other method. No record is included in the Signature Table for the directory search. For the file search, list the file signature and name in the Signature Table. The remaining fields in this record can be null to search for any version of MyApp.exe.

    Signature Table (partial)

    Signature File Name
    AppFile MyApp.exe

  2. Use the AppSearch Table.

    Enter the property that the Installer is to set if the directory with the signature AppDir is installed. If the Installer finds this directory is installed, it sets MYDIR to the directory path. Enter the property that the Installer is to set if MyApp.exe is installed.

    AppSearch Table (partial)

    Property Signature
    MYDIR AppDir
    MYAPP AppFile

  3. Use the DrLocator Table.

    Enter in the Parent column the signature, AppDir, that is defined as the path of the directory. Specify in the Depth column the number of subdirectory levels to search in this directory. AppDir must be defined as the directory signature. AppDir may be defined by including a record as shown here or by another method.

    DrLocator Table

    Signature Parent Path Depth
    AppDir C:\MyDir 0
    AppFile AppDir 0

  4. Include the AppSearch action in the action sequence.

    If MyApp.exe is found to be installed in AppDir, the Installer sets the property MYAPP to the location of file.

Related topics

Searching for Existing Applications, Files, Registry Entries or .ini File Entries

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。