Error in Batch for searching text in .txt

1

someone could support me with the following code, since I can not execute in several files by means of a .bat:

@echo off

set /p serial = Escribe el Serial:

set /a serial = (%serial%)
echo.

findstr /i /m /l /C:"%serial%" \server\Resultados\*.txt >> c:\lista.txt
color 60
PAUSE
    
asked by Cesar Victorino 09.09.2017 в 00:44
source

1 answer

0

To enter a string in a variable, you must concatenate the variable with the symbol = and the value indicated by the string to be entered, in this way:

set /p variable=cadena

if you separate them, it will not work correctly.

This would be the way to find the word defined in serial , in all the files with extension .txt contained in \server\Resultados\ , the results will save them in the file c:\lista.txt :

@echo off

set /p serial=Escribe el Serial:
echo buscando: %serial%!
echo.

findstr /i "%serial%" \server\Resultados\*.txt >> c:\lista.txt

color 60
PAUSE
    
answered by 09.09.2017 в 03:27