I am trying to produce a batch script that will locate some text inside of a .txt file. The folder contains hundreds of these txt files and need a script to split them. If the file contains the phrase
Initialisation Failed then I would like to store that .txt in another folder. If not then just leave it in the current folder.
Below I have an attempt that I used, but this would only work on a single file.
findstr/mc:"Initialisation Failed"
for /f "delims=" %%a in ('findstr /mc:"Initialisation Failed" *.txt') do move "%%a" "T:\Jack Lythgoe\Production Test\InitialisaionError_Review\batch test\error"
Expected Output - error (folder)
log223.txt
log24324.txt
log546.txt
log234.txt
Once the script has run, the files containing Initialisation failed should be transferred into error folder which is in that directory.
Error output from cmd
for /F "delims=" %a in ('findstr /mc:"Initialisation Failed" *.txt') do move "%a" "T:\Jack Lythgoe\Production Test\InitialisaionError_Review\batch test\error"
FINDSTR: Cannot open *.txt