[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off
  2. color 0a
  3. setlocal EnableDelayedExpansion
  4. set MASK=255.255.255.0
  5. set GATEWAY=192.168.123.254
  6. set DNS1=202.99.192.68
  7. set DNS2=219.150.32.132
  8. echo.
  9. echo.            完成获取资料,请检查正确后按确认键开始执行修改任务
  10. echo.*************************************************************************
  11. echo.
  12. for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%i
  13. echo.        本机 MAC地址 (硬件获取):       %Mac%
  14. for /f "tokens=1,2*" %%i in ('ipconfig /all^|find "Ethernet adapter"')  do set Ethernet=%%k
  15. for /f "tokens=1,2" %%i in ('more /e +13 %0 ^|find /i "%mac:~,-1%"') do set "name=%%i"&set
  16. "IP=%%j"
  17. echo         本机 IP 地址 (动态获取):        %ip%
  18. echo.
  19. echo.*************************************************************************
  20. pause
  21. reg add
  22. "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v
  23. ComputerName /t reg_sz /d %name% /f >nul 2>nul
  24. reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV
  25. Hostname" /t reg_sz /d %name% /f >nul 2>nul
  26. reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname
  27. /t reg_sz /d %name% /f >nul 2>nul
  28. netsh interface ip set address "%Ethernet:~,-2%" static %IP% %Mask% %GATEWAY% 1 >nul
  29. 2>nul
  30. netsh interface ip set dns "%Ethernet:~,-2%" static %DNS1% >nul 2>nul
  31. netsh interface ip set dns "%Ethernet:~,-2%" static %DNS2% >nul 2>nul
  32. pause&exit
  33. NB-100 192.168.0.100 00-E0-A0-0C-BD-56
  34. NB-101 192.168.0.101 00-1A-4D-9C-82-87
  35. NB-105 192.168.1.102 00-e0-4d-a6-10-8f
复制代码

综合一下。呵呵

[ 本帖最后由 6589600 于 2008-12-4 01:13 编辑 ]

TOP

返回列表