@echo off
Setlocal EnableDelayedExpansion
for /f "delims==" %%a in ('set Name_ID[ 2^>nul') do set "%%a="
for /f "usebackq tokens=1*" %%a in ("%~1") do set "Name_ID["%%a" name]="%%b">"
for /f "usebackq tokens=1-2* delims==" %%a in ("%~2") do (
set "Out_Srt=%%a"
echo;"!Out_Srt!"|find.exe /i "<weapon id">Nul && (
set "Out_Srt=!Out_Srt!=%%b=!Name_ID[%%b]!"
)||(
if %%b. NEQ . set "Out_Srt=!Out_Srt!=%%b"
if %%c. NEQ . set "Out_Srt=!Out_Srt!=%%c"
)
echo;!Out_Srt!
)
endlocal