gpt4 book ai didi

windows - 如果大于批处理文件

转载 作者:可可西里 更新时间:2023-11-01 12:04:57 25 4
gpt4 key购买 nike

我写了一个简单的批处理文件来运行基于数字选择的常用网站。这是我的代码。我正在尝试设置它,以便如果有人输入数字 6 或更大,它将转到 :N 但每当我输入 6 时,批处理文件就会退出。我试过 if %input% > 6 goto :N 但它只是告诉我我要去谷歌。

@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"

enter image description here

其他运算符是:

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

引用

关于windows - 如果大于批处理文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9278614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com