[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 ArdentMan 于 2011-7-7 12:23 编辑
  1. @echo off&setlocal enabledelayedexpansion
  2. echo 正在配置IP地址、DNS请稍候……
  3. set MASK=255.255.255.0
  4. set GATEWAY=192.168.1.1
  5. set DNS1=192.168.1.220
  6. set DNS2=192.168.1.1
  7. set WINS=192.168.1.200
  8. for /f "delims=:" %%i in ('findstr /n "exit$" %~fs0') do set "num=%%i"
  9. for /f "tokens=1-4" %%a in ('more +%num% %fs0') do set "" %%c"=a"&set "_ %%c=%%a"&set ". %%c=%%b"&set "@ %%c=%%d"
  10. for /f "tokens=3 delims=: " %%i in ('ipconfig /all^|finstr /c:"Ethernet adapter"') do set "Ethernet=%%i"
  11. for /f "tokens=2 delims=:" %%i in ('ipconfig /all^|findstr /c:"Physical Address"') do (
  12.   if defined "%%i" (
  13.     wmic computersystem where "name='!_%%i!'" call rename '!@%%i!'
  14.     netsh interface ip set address "%Ethernet%" static !.%%i! %MASK% %GATEWAY%>nul 2>nul
  15.     netsh interface ip set dns "%Ethernet%" static %DNS1% register=PRIMARY>nul 2>nul
  16.     netsh interface ip add dns "%Ethernet%" %DNS2% index=2>nul 2>nul
  17.     netsh interface ip set wins "%Ethernet%" static %WINS%>nul 2>nul
  18.   )
  19. )
  20. exit
  21. PC001        192.168.1.100        00-E0-4C-41-11-A6        祥子
  22. PC002        192.168.1.101        00-e0-62-0b-1f-6c        郝文婕
  23. PC003        192.168.1.102        00-e0-62-0b-22-6d        漆浪
  24. PC004        192.168.1.103        00-e0-66-02-b0-1e        彭雅娜
  25. PC005        192.168.1.104        00-e0-66-02-f1-c2        李颖诗
  26. PC006        192.168.1.105        00-e0-66-19-de-e9        陈永行
  27. PC007        192.168.1.106        00-e0-66-02-f4-15        宁智雄
  28. PC008        192.168.1.107        00-e0-66-02-b0-1e        彭雅娜
  29. PC009        192.168.1.108        00-e0-4c-41-11-b3        冯晶晶
  30. PC010        192.168.1.109        00-e0-66-02-df-8c        周国香
  31. PC011        192.168.1.110        00-e0-66-02-dd-d8        邓国花
  32. PC012        192.168.1.111        00-e0-66-0d-71-d9        邱瑾
  33. PC013        192.168.1.112        00-e0-66-19-de-ea        胡孝龙
复制代码
一路飘过的鸟~~~

TOP

返回列表