I'm creating a CoreHost app that needs to be able to call ArcPy scripts. To do this, we need (from what I understand) to know the local machine's python path - specifically the path of the python .exe installed with Arc Pro.
I've accomplished this on my development machine by just hardcoding the path to the ArcGIS directory in Program Files - but how can we get the appropriate executable without knowing where and how the user has installed Arc Pro?
Thank you Wolfgang Kaiser. For others interested, this is the code I used to grab the path from the registry key Wolfgang provided:
RegistryKey arcGISProInstallDirectoryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ESRI\ArcGISPro");
object pythonDirectoryKeyValue = arcGISProInstallDirectoryKey.GetValue("PythonCondaRoot");
string pythonDirectoryPath = pythonDirectoryKeyValue.ToString();
string localExecutablePath = @"Scripts\propy.bat";
string pythonExeutablePath = Path.Combine(pythonDirectoryPath, localExecutablePath);
This works on a local machine, I don't know how you can access that information on another machine
In my case, arcgis pro is installed in the c:\arc_pro folder
which yields the same as the registry if you parse the \\envs... onward off