I would like to detect if java has been installed on a machine, and if so which JRE version. I have a simple .bat file script that runs and queries the registry. This works okay when run alone but when run within the Qt installer the same command returns no key, value pairs. I am a bit stumped. I have tried elevating the installer when executing the command, but frankly the script succeeds when running without privileges from the command, and it also did not make a difference.
For instance, when running a simplified version of the command:
for /f "tokens=*" %%j in (
'reg query "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment"'
) do ( echo %%j )
When running the standalone script the registry values are printed out but when the same file is invoke (it is not compiled in to the installer but called via run-time) the same command above returns nothing.
I am using Qt installer framework 3.0.5.
The script is located in: com.domain.packagex\meta\myscript.bat
And is called from the package component qs script:
var returnArray =
installer.execute(".\\packages\\com.domain.packagex\\meta\\myscript.bat");
...
From the printouts when run from the installer installer I can see that the script is being run and that is the latest version but the printouts look different (query command returns nothing). I have checked that the error level remains the same before and after the registry query.
I do not see this problem on my own Windows 10 (x64) machine but I do see it on a Virtualbox Windows 10 (x64) machine..