batch file - Double IF does not work? -


with code want

if %var% > 5 , if %var% <10 then.  

it works 2 instance "no" "11" program ends , gets closed instead of following "else" can me solve this?

code:

@echo off :debut set /p "var=type text:" if %var% geq 5 (      if %var% leq 10 ( echo yeah goto debut   ) ) else ( echo no goto debut ) 

output:

type text:2 no type text:4 no type text:5 yeah type text:6 yeah type text:8 yeah type text:10 yeah type text: 

here attempt @ rewrite.

@echo off :debut set/p "var=type text: " if %var% geq 5 if %var% leq 10 echo=yeah goto debut 

edit

if you're looking output yeah or no in every scenario, here's 1 method:

@echo off :debut set "_=" set/p "var=type text: " if %var% geq 5 if %var% leq 10 set "_=t" if not defined _ (echo=no) else echo=yeah goto debut 

and another:

@echo off :debut set/p "var=type text: " if %var% geq 5 (if %var% leq 10 (echo yeah) else echo no) else echo no goto debut 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -