Originally posted by zw19750516 at 2008-4-12 14:09:
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (gw.txt) do (
set a=%%i
if "!a:~,3!"=="118" set ctt=!a!
if "!a:~,6! ...
有点问题,gw.txt每行前面都有个空格,改成这样就行了(暂时用了echo来代替set)
@echo off&setlocal enabledelayedexpansion
if exist gw.txt del gw.txt
for /f "tokens=1* delims=:" %%i in ('ipconfig^|find /i "Default Gateway"') do @echo %%j>>gw.txt
for /f "delims=" %%i in (gw.txt) do (
set a=%%i
if "!a:~1,3!"=="118" echo ctt=!a:~1!
if "!a:~1,6!"=="172.28" echo tel=!a:~1!
if "!a:~1,6!"=="172.29" echo cnc=!a:~1!
)
pause
Last edited by feifeiyucn on 2008-4-12 at 02:56 PM ]