如果大于批处理文件 [英] If greater than batch files
问题描述
我写了一个简单的批处理文件来运行基于一些选择常用的网站。这里的code我有。我想如果有人输入一个数字6,设置它或大于它会去:N
,但每当我型6批处理文件退出。我曾尝试如果%的输入%GT; 6转到:N
,但它只是告诉我,我将谷歌
关闭@echo
:START2
CLS
转到启动
:开始
标题常用的网站
回声请从列表中选择一个网站
回声相应的键
--------------------------------------呼应
回声[1]谷歌
回声[2]维基
回声[3]实
回声[4]的Youtube
回声[5]雅虎
设置输入=
集/ P输入=选择:
如果输入%%== 1页转到Z如果不转到START2
如果输入%==%2转到X如果不转到START2
如果输入%==%3转到ç如果没有转到START2
如果输入%==%4转到v如果不转到START2
如果输入%==%5转到B如果不转到START2
如果输入%%GT; = 6转到ñ:Z
CLS
回声您选择谷歌
暂停
启动www.google.com
出口
:X
CLS
回声您选择维基百科
暂停
启动www.wikipedia.com
出口
:C
CLS
回声您选择的Facebook
暂停
启动www.facebook.com
出口
:V
CLS
回声您选择的Youtube
暂停
启动www.youtube.com
出口
:乙
CLS
回声您选择雅虎
暂停
启动www.Yahoo.com
出口
:N
CLS
回声无效的选择!再试一次
暂停
转到:START2
试试这个:
如果3 GTR 2 @echobiggger
此输出:
biggger
其他的操作符是:
EQU - 等于结果
NEQ - 不等于结果
LSS - 小于结果
LEQ - 小于或等于结果
GTR - 比结果更大
GEQ - 大于或等于
块引用>
I wrote a simple batch file to run Frequently Used websites based on a number selection. Here's the code I have. I am trying to set it so if someone inputs a number 6 or greater it will go to
:N
but whenever I type 6 the batch file exits. I have triedif %input% > 6 goto :N
but it just tells me I am going to Google.@echo off :Start2 cls goto Start :Start title Frequently Used Websites echo Please select a website from the list echo with the corresponding key echo -------------------------------------- echo [1] Google echo [2] Wikipedia echo [3] Facebook echo [4] Youtube echo [5] Yahoo set input= set /p input= Choice: if %input%==1 goto Z if NOT goto Start2 if %input%==2 goto X if NOT goto Start2 if %input%==3 goto C if NOT goto Start2 if %input%==4 goto V if NOT goto Start2 if %input%==5 goto B if NOT goto Start2 if %input%>=6 goto N :Z cls echo You have selected Google pause start www.google.com exit :X cls echo You have selected Wikipedia pause start www.wikipedia.com exit :C cls echo You have selected Facebook pause start www.facebook.com exit :V cls echo You have selected Youtube pause start www.youtube.com exit :B cls echo You have selected Yahoo pause start www.Yahoo.com exit :N cls echo Invalid Selection! Try again pause goto :start2
解决方案try this :
if 3 gtr 2 @echo "biggger"
This outputs:
"biggger"
The other operators are:
EQU - equal
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal这篇关于如果大于批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!