如何解决如何将变量与某个值进行比较,如果它具有该值,则脚本应在 CMD 中继续
@echo off
Title Ping
color b
echo Enter the website you would like to ping
set input=
set /p input= Enter your Website here:
color d
echo Enter the password for the program
set input2=
set /p input2= Enter the Pass here:
color b
IF [input2] EQU [1234]
它应该检查 Input2
是否等于 1234
,如果是,脚本应该继续,如果它不等于 1234
就应该等待。
我想这很简单,但我似乎没有让它工作。脚本也只是在最后一行代码之后崩溃。
解决方法
好的,我花了一些时间在代码上,我想我现在完成了。
@echo off
Title Ping
color b
echo Enter the website you would like to ping
set input=
set /p input= Enter your Website here:
set input2=
set /p input2= Enter Password here:
if /I "%input2%" NEQ "1234" GOTO END
setlocal
:PROMPT
set AREYOUSURE=
SET /P AREYOUSURE=Are you sure (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END
set x=
set /p x= How many times you like to ping?
color c
cls
echo -------------------------------------------------------------
echo now pinging %input% %x% times press strg + c to cancel
echo -------------------------------------------------------------
color a
ping -l 65500 -n %x% %input%
:end
endlocal
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。