When you put the executable on the machine, presumably with your installer, you know where you put it. You will have had to find out the path to the program files folder in order to copy the file. At that point, the location is fixed. The machine is either 32 bit or 64 bit. It cannot change. So, you know the path to the executable, and you simply write that path to the registry.
Typically you will be doing all this from your installer program. And it will know where the file was installed. It will provide functionality to write this registry key using the actual location of the file that it is installing.
There is no need at all for any more indirection at this point. By the time you have got as far as writing a file to the machine, you have chosen a location for it. That choice is then static. If the file went in Program Files (x86)
then that's where it is. If it went in Program Files
, again there it is. You simply don't need to encode the indirection into the registry because the indirection has been expanded at this point.