Hi all,
I would like to know how to check for text in a text document.
Eg:
(in text document) Hello World!
And then the batch file would do something like:
if exist "hello world" (do whatever)
Could someone do that? If so then could you tell me the code to do so?
Any help would be appreciated,
Rileyh
How to check for text in a text document
Moderator: DosItHelp
Re: How to check for text in a text document
aGerman,
I think that either their is an error with your code or my code because I copied and pasted your code into my existing code and it didn't work.
Here is my code. Hopefully you can (from looking at my code) see what I am trying to do:
Do you see what I am trying to do.
If not, post a reply.
Regards,
Rileyh
I think that either their is an error with your code or my code because I copied and pasted your code into my existing code and it didn't work.
Here is my code. Hopefully you can (from looking at my code) see what I am trying to do:
Code: Select all
@echo off
findstr /ic:"print" "test.txt" >nul &&(
)
echo It worked.
pause <nul
goto :eof
:b
echo It worked.
pause >nul
Do you see what I am trying to do.
If not, post a reply.
Regards,
Rileyh
Re: How to check for text in a text document
The REM line is only a remark/comment. You have to replace it with your code which should be executed if "print" was found in "test.txt".
Regards
aGerman
Regards
aGerman