Getting the unity install dir on the fly


I was wondering if anyone knew of maybe a registry key or something that can be used to identify the full install dir of the unity.exe. Reason I ask is I am building an app to run Unity via the command line and I don’t want to hard code the Unity install path.

Thanks in advance!!

Actually it could change where Unity stores the install path. However my Unity version 5.6.1f1 has this key in the registry:

HKEY_CURRENT_USER\SOFTWARE\Unity Technologies\Installer\Unity\

Under that key there’s a string value named "Location x64" which holds the installation path which is

C:\Program Files\Unity

on my machine. Of course i have the 64 bit version installed.