I'd like to know if it is possible to find the installation directory of an application under Windows 7, such as MS Excel, with standard python 2.7 libraries. I mean, it shouldn't use any pywin32, or xlrd etc.
Maybe it will look up registry to find the installation path?
It might be quite tricky, however one approach would be to search for the launcher exe location in
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\foo.exe
Thusly something like this (I do not have Windows on this computer, so edits are welcome if bugs found ;), code should be Python 2 and 3 compatible):
On Python 2 the module is named
_winreg
, butwinreg
on Python 3.