日期:2014-05-17 浏览次数:21089 次
set ip=""
set ip1=""
for /f "tokens=1,2 delims=:" %%a in ('ipconfig^|find "IPv4 Address"') do (set ip1=%%b
if "%ip1:~1,3%"=="10." (set ip=%ip1:~1%
echo 1)
if "%ip1:~1,3%"=="192" (set ip=%ip1:~1%
echo 2)
if "%ip1:~1,3%"=="168" (set ip=%ip1:~1%
echo 3))
@echo off
setlocal enabledelayedexpansion
set "ip="
set "ip1="
for /f "tokens=1,2 delims=:" %%a in ('ipconfig ^
------解决方案--------------------
find "IPv4 Address"') do (
set ip1=%%b
set ip=!ip1:~1!
if "!ip1:~1,3!"=="10." (
echo 1
)
if "!ip1:~1,3!"=="192" (
echo 2
)
if "!ip1:~1,3!"=="168" (
echo 3
)
)
pause