I need copy specific line of one text file, then is file replaced with selected other file and substitute same line with copied text line. I have command line:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set mca=%cd%
cd /d %SYSTEMDRIVE%\PMJ\PROGRAMS\
set programs=%cd%
:select
echo.
echo Which file?
echo.
echo (without.PRG)
echo.
set /p load=
if exist %programs%\%load%.PRG (goto start) else (goto err1)
:err1
echo Not found
goto select
:start
for /F "tokens=*" %%B in (%mca%\mlfb.txt) do (
findstr /B /C:" InterlockingName = " %programs%\%%B > %mca%\actual.txt
set /p "actual= < %mca%\actual.txt"
copy /y %programs%\%load%.PRG %programs%\%%B
fart -a %programs%\%%B " InterlockingName = " %actual%
)
Searched line begins InterlockingName =
then contains different characters.
File mlfb.txt contains
40AK11600.PRG
40AK11601.PRG
40AK11602.PRG
40AK11603.PRG
40AK11604.PRG
40AK11605.PRG
40AK11637.PRG
40AK11638.PRG
40AK11653.PRG
4OAK11609.PRG
5WK11706.PRG
A2C5330886804.PRG
A2C8171710004.PRG
Line
findstr /B /C:" InterlockingName = " %programs%\%%B > %mca%\actual.txt
creates file actual.txt, which contains string - for example
InterlockingName = 40AK11600
Command
copy /y %programs%\%load%.PRG %programs%\%%B
replace one file with selected file, but I can not to substitute line of replaced file with line in file actual.txt
fart -a %programs%\%%B " InterlockingName = " %actual%
(if file actual.txt is not needed, it can be eliminated).