I cannot use VB Script and I have to accomplish this task in one single .bat
file. Can you please help me run both items simultaneously?
- add registry key command
- carry out an IF statement and commands
Add to registry:
REGEDIT4
;@start regedit /s "%~f0"&goto :eof
[HKEY_LOCAL_MACHINE\Software\TEST]
Carry out my task:
:CheckOS
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)
:64BIT
setlocal ENABLEDELAYEDEXPANSION
set filein="c:\Program Files (x86)\Premier MDC\mdt.ini"
set fileout="c:\Program Files (x86)\Premier MDC\mdtnew.ini"
set fileold="c:\Program Files (x86)\Premier MDC\mdtold.ini"
set old=10.17.8.64
set new=10.253.0.1
for /f "tokens=* delims=¶" %%i in ( '"type %filein%"') do (
set str=%%i
set str=!str:%old%=%new%!
echo !str! >> %fileout%)
move %filein% %fileold%
move %fileout% %filein%
GOTO END
:32BIT
setlocal ENABLEDELAYEDEXPANSION
set filein="c:\Program Files\Premier MDC\mdt.ini"
set fileout="c:\Program Files\Premier MDC\mdtnew.ini"
set fileold="c:\Program Files\Premier MDC\mdtold.ini"
set old=10.17.8.64
set new=10.253.0.1
for /f "tokens=* delims=¶" %%i in ( '"type %filein%"') do (
set str=%%i
set str=!str:%old%=%new%!
echo !str! >> %fileout%)
move %filein% %fileold%
move %fileout% %filein%
GOTO END
:END
I have tested these independently from each other in seperate .bat files and they work perfectly. I just need help combining them into one file and have it run both tasks. Thanks.