moh3, Это плохая идея отрезать кусок строки - в зависимости от исходных данных её длина разная.
Код:
@Echo Off
cls
Set "FileIn=Z:\Box_In\printer.txt"
Set "names_comp=\SPIDER-03"
Set "name_print=Canon LBP6020"
rem Set "names_comp=\SPIDER-02"
rem Set "name_print=HP LaserJet M14-M17 PCLmS"
Set /A N=100
FOR /F "usebackq tokens=1* delims==" %%i IN (`2^>nul FindStr /I /C:"names_comp" /C:"name_print" /C:"caunt_other_cartridg" "%FileIn%"`) DO (
If /I "%%i"=="names_comp" (Set /A N+=1 &Set "Out=")
Call Set "Out=%%Out%%%%j="
Call Set "@@%%N%%=%%Out%%"
)
FOR /F "usebackq tokens=4 delims==" %%i IN (`2^>nul Set "@@" ^|FindStr /I /C:"%names_comp%=%name_print%="`) DO Set "caunt_other_cartridg=%%i"
Echo %caunt_other_cartridg%
Pause
Exit /B 0