title: Determine InstallPath using REG QUERY
body: <p>I am using a batch file to determine the <code>InstallPath</code> of R using <code>REG QUERY</code>:</p>
  
  <pre><code>@echo off
  
  REM get path
  for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\R-Core\R64" /v InstallPath') do set "RPath=%%~b"
  
  set "var=\bin\R.exe --no-save"
  set "R=%RPath%%var%"
  
  REM start R fed with a script
  %R% &lt; "path.to.some.rfile.r"
  </code></pre>
  
  <p>This used to work perfectly until I updated R to version 3.4.1 which writes the key of <code>InstallPath</code> to a subfolder in the windows registry. </p>
  
  <p>Since this subfolder is named by the version of R and I want the batch file to work independently from the R-version, I want to get <code>InstallPath</code> from any existing subfolder. How could I mangage to do that?</p>