Page 1 of 1

Looking for text in a file

Posted: 31 Jan 2019 11:38
by Docfxit
I am writing out a file and trying to find some text in the file. It isn't finding the text.

Code: Select all

Bootrec /scanos >"%~dp0BootFixerTest.txt"
type "%~dp0BootFixerTest.txt" |find /i "Windows installations: 0" >nul || goto :Done
Pause
:Done
The file has in it:

Code: Select all

Scanning all disks for Windows installations.

Please wait, since this may take a while...

Successfully scanned Windows installations.
Total identified Windows installations: 0
The operation completed successfully.
I would like it to go to Done but it doesn't.

Docfxit

Re: Looking for text in a file

Posted: 31 Jan 2019 15:53
by Squashman
The code snippet and input example you provided works as provided. Must be something you are not showing us.

Re: Looking for text in a file

Posted: 31 Jan 2019 16:04
by Docfxit
Thank you for taking a look at it.

The only thing I have is a pause after the line. (I have added the pause in my example)

The script goes to the pause instead of going to Done.

Thanks,

Docfxit

Re: Looking for text in a file

Posted: 31 Jan 2019 16:06
by Squashman
Why would it go to done? The double pipe does not mean TRUE (Successfule). It means false (unsuccessful). The only way it will go to done is if it doesn't find it.
https://www.robvanderwoude.com/condexec.php

Re: Looking for text in a file

Posted: 31 Jan 2019 17:23
by Docfxit
That's supper. That fixed it for me.

It's really great of you to point out what is / should happen.

Thank you very much,

Docfxit