- @echo off
- set "s=Setting.ini"
- ping -n 1 >www.baidu.com>nul 2>nul||exit
- for /f "tokens=3* delims=. " %%a in ('Ipconfig^|find /i "ip address"') do set ip=%%b
- for /f "tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\2" /v ServiceName') do set n=%%a
- (for /f "usebackq eol=# tokens=1* delims==" %%a in ("%s%") do (
- set "b=%%b"&set "a=%%a"
- setlocal enableDelayedExpansion
- if /i "%%a"=="ADAPTER_NAME" set b=%n%
- if /i "%%a"=="MY_IP" set b=%ip%
- if defined b (echo !a!=!b!) else (
- if "!a:~0,1!!a:~-1!"=="[]" (echo !a!) else echo !a!=
- )
- Endlocal
- ))>temp.h
- move temp.h "%s%"
复制代码
[ 本帖最后由 hanyeguxing 于 2011-1-21 02:38 编辑 ] |