I want to write a .bat script which finds a folder for installed program (e.g. Acrobat\JavaScript) because the folder can have a different path on every computer. Then put a .js file and a imgfolder inside. The .js file and the imgfolder is in the same folder as the .bat script. How can I find the full path of Acrobat\JavaScript on drive C and save to variable in order to copy the .js inside?
Here is what I tried:
@echo off
REM  find the folder with my .bat file 
for /f %%i in ("%0") do set curpath=%%~dpi 
echo  %curpath% 
REM it fails on this place:
for /R "C:\Programm Files(x86)" /D %d in (*) 
  do @if "%~nd" == "Acrobat\JavaScript" 
REM  I want to save here the path "%d" to a variable  in order to use it for copying
echo "%d"  
pause
If it works, I'll use this to copy imgfolder and the .js file to the retrieved path:
XCOPY %curpath%\imgFolder %d
To copy a folder:
XCOPY %curpath%\script.js %d /i
UPDATE:
I checked in the register, I found HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Adobe Acrobat\ and then all the versions 9.0 - 11.0. As I understood the path is saved in the folder InstallPath, therefore I combined:
 "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" /v InstallPath') ... 
Is it right?
 set path=""
 for /f "tokens=1-2*" %%A in ('reg query   "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" /v InstallPath') do (
 set path="%%C\JavaScript"
 )
echo path
pause
Error:
W:\batScript>for /F "tokens=1-2*" %A in ('reg query "HKLM\Software
\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" /v InstallPath') do (se
t path="%C\VBoxManage.ex" )
'reg' is not recognized as an internal or external command, operable program or batch file.
I tried with reg.exe query, the same error. What I am doing wrong?
 
    