How to find the installation path of an Office application – Office

Microsoft Technical Article






Technical Guide: Locating Office Installation Paths

Programmatic Retrieval of Microsoft Office Installation Paths

🚀 Overview

For IT administrators and developers, determining the exact file system location of Microsoft Office executables can be surprisingly complex. Starting with Office 2000, Microsoft transitioned to a deployment model where shortcut links do not contain direct paths to the binaries. This architecture supports the “Run on First Use” feature, allowing shortcuts to exist on a user’s machine before the actual application files are present on the local disk.

Because these “advertised shortcuts” trigger an installation routine rather than a direct file launch, standard directory crawling or shortcut parsing often fails. To reliably identify where an Office application is residing, administrators must query the Windows Installer (MSI) database. This article details how to leverage the MSI API and specific Component GUIDs to programmatically discover installation directories across various versions of the Office suite.

⚙️ Key Technical Details

The most accurate method for locating an Office component is to use the MsiLocateComponent or MsiGetComponentPath functions. This requires targeting the specific Component GUID associated with the application (e.g., Word, Excel, or Access).

Building a Diagnostic Tool

To implement this logic, you can develop a C++ console application. Follow these steps to compile a path-discovery tool:

  1. Initialize a blank console application project within Visual C++.
  2. Create a source file named main.cpp.
  3. Insert the following code block into the file:
#include <windows.h>
#include <msi.h>
#include <ostream.h>

const char *Word = "{CC29E963-7BC2-11D1-A921-00A0C91E2AA2}";
const char *Excel = "{CC29E96F-7BC2-11D1-A921-00A0C91E2AA2}";
const char *PowerPoint = "{CC29E94B-7BC2-11D1-A921-00A0C91E2AA2}";
const char *Access = "{CC29E967-7BC2-11D1-A921-00A0C91E2AA2}";
const char *Office = "{00000409-78E1-11D2-B60F-006097C998E7}";

int main(void)
{
DWORD size = 300;
INSTALLSTATE installstate;
char *sPath;

sPath = new char[size];
        installstate = MsiLocateComponent(Word,sPath,&size);

if ((installstate == INSTALLSTATE_LOCAL) || 
         (installstate == INSTALLSTATE_SOURCE)) 
cout << "Installed in: " << sPath << endl;
delete sPath;
return 0;
}

Note: You must configure your project to link against the msi.lib library. Navigate to Project Settings > Link tab and ensure msi.lib is included in the Object/library modules list.

📅 Version-Specific Component GUIDs

The GUID constants used in the code must match the version of Office installed on the target system. Use the following references to update your implementation:

Office XP

const char *Word = "{8E46FEFA-D973-6294-B305-E968CEDFFCB9}";
const char *Excel = "{5572D282-F5E5-11D3-A8E8-0060083FD8D3}";
const char *PowerPoint = "{FC780C4C-F066-40E0-B720-DA0F779B81A9}";
const char *Access = "{CC29E967-7BC2-11D1-A921-00A0C91E2AA3}";
const char *Office = "{20280409-6000-11D3-8CFE-0050048383C9}";

Office 2003

const char *Word = "{1EBDE4BC-9A51-4630-B541-2561FA45CCC5}";
const char *Excel = "{A2B280D4-20FB-4720-99F7-40C09FBCE10A}";
const char *PowerPoint = "{C86C0B92-63C0-4E35-8605-281275C21F97}";
const char *Access = "{F2D782F8-6B14-4FA4-8FBA-565CDDB9B2A8}";
const char *Office = "{90110409-6000-11D3-8CFE-0150048383C9}";

Office 2007

const char *Word = "{0638C49D-BB8B-4CD1-B191-051E8F325736}";
const char *Excel = "{0638C49D-BB8B-4CD1-B191-052E8F325736}";
const char *PowerPoint = "{0638C49D-BB8B-4CD1-B191-053E8F325736}";
const char *Access = "{0638C49D-BB8B-4CD1-B191-054E8F325736}";
const char *Office = "{0638C49D-BB8B-4CD1-B191-050E8F325736}";

Office 2010 (32-bit)

const char *Word = "{019C826E-445A-4649-A5B0-0BF08FCC4EEE}"; 
const char *Excel = "{538F6C89-2AD5-4006-8154-C6670774E980}";
const char *PowerPoint = "{E72E0D20-0D63-438B-BC71-92AB9F9E8B54}";
const char *Access = "{AE393348-E564-4894-B8C5-EBBC5E72EFC6}";
const char *Office = "{398E906A-826B-48DD-9791-549C649CACE5}";

Office 2010 (64-bit)

const char *Word = "{C0AC079D-A84B-4CBD-8DBA-F1BB44146899}"; 
const char *Excel = "{8B1BF0B4-A1CA-4656-AA46-D11C50BC55A4}";
const char *PowerPoint = "{EE8D8E0A-D905-401D-9BC3-0D20156D5E30}";
const char *Access = "{02F5CBEC-E7B5-4FC1-BD72-6043152BD1D4}";
const char *Office = "{E6AC97ED-6651-4C00-A8FE-790DB0485859}";

🛡️ Impact

  • Administrator Efficiency: This method eliminates the guesswork involved in identifying installation directories across diverse environments, facilitating more robust automation and maintenance scripts.
  • System Integrity: By using the Windows Installer API, admins ensure they are interacting with the system’s official record of software state, rather than relying on potentially fragile hardcoded paths.
  • User Experience: Understanding “Run on First Use” behavior explains why certain applications may appear in the UI but lack a physical presence on the disk until launched, which is critical for troubleshooting “missing file” tickets.
  • Scalability: The ability to programmatically query these paths allows for high-precision software inventory and compatibility checks during OS migrations or Office upgrades.