jeudi 23 juillet 2020

If else String compare statement not working in batch code

I am trying to compare 2 string by variable using the code

@echo off
Set txt1=this is a string
set txt2=this is a string
set txt3=%txt1%
set txt4=%txt2%
@echo %txt3%........%txt4%
if %txt3%==%txt4% (echo eql) else (echo not eql)

SET /p exit= enter to exit

It's not work but when i compare txt1 and txt2 it's working. I have compare txt3 and txt4. What is the way?

Aucun commentaire:

Enregistrer un commentaire