dimanche 28 octobre 2018

Batch file IF statement only using first character

Not quite sure what I'm doing wrong. For the most part, this works. If I were to type just 1, I would go to opt1.

The problem is, if I type "11", "1111", or even "1234567" it always goes to opt1. The only time it seems to not select opt1 is when the first number is something other than 1.

Could someone kindly point me in the right direction?

SET ans=
SET /P ans="Select your option and then press ENTER: "
IF "%ans%" == "1" GOTO opt1

Aucun commentaire:

Enregistrer un commentaire