如果大于批处理文件 [英] If greater than batch files

查看:129
本文介绍了如果大于批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个简单的批处理文件来运行基于数字选择的常用网站。这里是我有的代码。我试图设置它,所以如果有人输入数字6或更大,它会去:N ,但每当我键入6批处理文件退出。我试过如果%input%> 6 goto:N 但它只是告诉我我要去Google。

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 tried if %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


推荐答案

请尝试:

if 3 gtr 2 @echo "biggger"

这会产生:

"biggger"

其他操作符是:


- 等于

NEQ - 不相等

LSS - 小于

LEQ - 小于或等于

GTR - 大于

GEQ - 大于或等于

EQU - equal
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal

这篇关于如果大于批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆