質問-1) 私は 2 つのファイルを持っています
file1 が持っている
abc=123
acd=234
helloa=455
hellob=768
adb=234
file2 が持っている
abc=123
acd=564
helloa=2343
hellob=123
adb=685
私は文字列helloa
を知っていますが、その右側に何があるかわかりません。私がしたいことは、file1のhellob
右側の値をfile2の値に変更することです。helloa
hellob
私が試したこと
set a=0
for /f "delims=" %%i in ('^<file1 findstr /n "^"') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:*:=!"
if not "!line!"=="!line:helloa=!" set a=!line!
endlocal
)
次にfile1の行を置き換えますが、行はaにコピーされず、aはまだ0です
question-2) file1 の拡張子
line1
line2
hello1
hello2
ファイル2
line1
line2
hello1
hello2
hello3
ここで、file1 のすべての行を削除し、それらをfile2 の行にhello
置き換えたいhello