vendredi 7 septembre 2018

Using IF to compare result of a variable - Command Prompt

I want to compare the result of this variable:

set "var=type list.txt | find /c /v "" "

How do I check if the result of this command equals to "26"?

I tried some things like that, but it didn't work:

@echo off
set "var=type list.txt | find /c /v "" "
IF "%var%"=="26" (
    ECHO bingo
)
pause

Is guess it's comparing the content of var instead of its result.

Any help is much appreciated.

Aucun commentaire:

Enregistrer un commentaire