檢測ip格式是否正確的批處理
更新時間:2009年05月11日 12:56:26 作者:
檢測IP格式是否標準
復制代碼 代碼如下:
@echo off
:: 檢測IP格式是否標準
:: code by jm 2006-10-23
:begin
cls
set input=
set /p input=請輸入IP:
echo %input%|findstr "^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$">nul||goto fail
set _input=%input:.= %
call :check %_input%
:check
if "%4"=="" goto fail
for %%i in (%1 %2 %3 %4) do (
if %%i gtr 255 goto fail
)
cls
echo %input% 是正確的IP
echo.
pause
goto begin
:fail
cls
echo %input% 是錯誤的IP
echo.
pause
goto begin
相關文章
最新萬能 DOS 啟動盤制作全攻略(軟盤+光盤+U盤+硬盤+NTFS+應急實用工具)
這篇文章主要給大家介紹了關于最新萬能DOS啟動盤制作全攻略,軟盤+光盤+U盤+硬盤+NTFS+應急實用工具的相關資料,需要的朋友可以參考下2006-12-12