This project has moved and is read-only. For the latest updates, please go here.

Passing Variables in Batch File

Mar 6, 2013 at 12:04 AM
I am having an issue with the program not modifying the files from within a batch file. Here is my batch file (within the square brackets), with the fnr.exe command at the end:

[***********************
@ECHO off
SET /p BUILD=What EQUIP version is being installed?
SET /p DRIVE=What Drive is the Auto-IT folder located on (C,D,E,etc)?

IF NOT EXIST %DRIVE%:\%BUILD%Download\Reg_Key_Backup (
ECHO Creating registry backup directory...
mkdir %DRIVE%:\%BUILD%Download\Reg_Key_Backup
)

ECHO.

IF EXIST %DRIVE%:\%BUILD%Download\Reg_Key_Backup (
ECHO Backing up DBProfiles.reg
reg export "HKLM\SOFTWARE\Wow6432Node\Auto-I.T. Pty Ltd\Units\2.0\Database Profiles" %DRIVE%:\%BUILD%Download\Reg_Key_Backup\DBProfiles.reg
ECHO.
ECHO Backing up ODBCINI.reg
reg export "HKLM\SOFTWARE\Wow6432Node\ODBC\ODBC.INI" %DRIVE%:\%BUILD%Download\Reg_Key_Backup\ODBCINI.reg
)

ECHO.

cd /D %DRIVE%:\%BUILD%Download\Reg_Key_Backup
copy DBProfiles.reg "%DRIVE%:\%BUILD%Download\Build_%BUILD%\AppSupport\DealerSettings\Support\DealerProfile.reg"
copy ODBCINI.reg "%DRIVE%:\%BUILD%Download\Build_%BUILD%\AppSupport\DealerSettings\Support\DealerODBC.reg"
PAUSE

"%DRIVE%:\%BUILD%Download\fnr.exe" --cl --dir "%DRIVE%:\%BUILD%Download\Build_%BUILD%\AppSupport\DealerSettings\Support" --fileMask "Dealer*.reg" --excludeFileMask ".dll, .exe" --caseSensitive --find "\Wow6432Node\" --replace "\"

pause

***********************]

Outside of the batch file, it works great. So my questions is, does using fnr.exe within a batch file pass the set variables to the command. I have looked at this for several days now and don't see a problem.

Any help would be appreciated.

Thanks,
Chris
Jun 18, 2013 at 11:48 PM
Edited Jun 19, 2013 at 12:03 AM
I had the same issue. Add an extra backslash at the end of the find text (e.g. "\Wow6432Node\\"). It is just the last one that causes the issue. You may have to do the same for the replace clause.