Batch script to search for a string and return the result
Zorc
-
dubcek Posted messages 18627 Registration date Status Contributor Last intervention -
dubcek Posted messages 18627 Registration date Status Contributor Last intervention -
Hello,
I am facing a problem with my batch script.
Here is the process of the script that I would like to set up:
For all the files in c:\dossier\*.txt, search for the string "toto". If the file contains this string "toto", return the path of this file in c:\resultat.txt
Here is what I have tried but does not work
FOR /F "tokens=1,2* delims=: " %%A IN ('FIND /C "toto" c:\*.txt) DO (
IF %%A GTR 0 ( %%B >>resultat.txt )
)
Thank you for your help
Configuration: Windows 7 / Internet Explorer 9.0
I am facing a problem with my batch script.
Here is the process of the script that I would like to set up:
For all the files in c:\dossier\*.txt, search for the string "toto". If the file contains this string "toto", return the path of this file in c:\resultat.txt
Here is what I have tried but does not work
FOR /F "tokens=1,2* delims=: " %%A IN ('FIND /C "toto" c:\*.txt) DO (
IF %%A GTR 0 ( %%B >>resultat.txt )
)
Thank you for your help
Configuration: Windows 7 / Internet Explorer 9.0
FOR %%A IN (FIND "toto" c:\folder\*.txt) DO (%%A >> c:\result.txt)