Reputation: 3526
I am trying to use the following set of commands
FOR /f %%B IN ('DIR %SOME_FOLDER_LOCATION%\*.html ^| FIND "File(s)"') DO SET cnt=%%B
ECHO %cnt%
and
TYPE %SOME_TEXT_FILE_PATH% | FIND /V /C "abcxyzabczyx"
After this i need to compare the output from both the lines and based on that display some status something like:
IF [%cnt%]==['TYPE %SOME_TEXT_FILE_PATH% | FIND /V /C "xyzxyzxyzxyz"'] ECHO CORRECT
The second portion of comparison is repetition. Wrote it just to give you an idea.
Can anyone suggest how this can be done.
Upvotes: 0
Views: 190
Reputation: 67296
To count the number of .html files, I would use this method:
SET cnt=0
FOR %%B IN (%SOME_FOLDER_LOCATION%\*.html) DO SET /A cnt=cnt+1
ECHO %cnt%
To count the number of finds, I would use this:
FOR /f %%B IN ('FIND /V /C "abcxyzabczyx" %SOME_TEXT_FILE_PATH%') DO SET finds=%%B
This way, to compare both numbers:
IF [%cnt%] == [%finds%] ECHO CORRECT
I hope it helps...
Upvotes: 1
Reputation: 354864
Do the first one twice with your different command lines, but set a different variable too. Then just compare the two variables.
Upvotes: 1