Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement check input by batch bat

Shulou Source: shulou.com Published: 2022-06-03 08:39:38 11月14日 Update

Editor to share with you how to achieve batch bat check input, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

The code is as follows:

@ echo off

Set massif 0

: agn

Set / a macaque 1

If m gtr 5 (

Echo. The five opportunities have been used up and will exit automatically in 3 seconds.

Ping-n 4 127.1 > nul

Goto: eof

)

Please enter 3 to 10 letters for set input=&set / p input=:

If not defined input (echo. Content cannot be empty!! & goto: agn)

Echo.%input% | findstr / I / v "^ [a Murz] * $" > nul&& (echo. Please enter pure English letters!! & goto: agn)

Set nasty 0

: count

Set / a naughty 1

If not "% input:~1%" = "" (set input=%input:~1%&goto: count)

If n lss 3 (

Echo. Enter no less than 3 letters! Please re-enter!

Goto: agn

) else (

If n gtr 10 (

Echo. You typed too much! Please re-enter!

Goto: agn

)

)

Set / p = what you enter is within the allowed range. Please press any key to exit. Nul

Goto: eof

The above is all the content of the article "how to check input in batch bat". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Input content letters articles check English not much code most more opportunities knowledge scope industry information information channels channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Redmi Xiaomi MariaDB Shulou Technology