给个例子给你,我以前用的
-
- @echo off
- rem 原理:根据MAC地址来判断IP及机号.
- rem 先要获取网吧全部机器的MAC地址,再将其添加到如下例表中.
- rem 将本脚本添加到开始启动菜单.
- rem GHOST完成之后选择自动重启客户机即可!
- rem ...............以下是MAC、IP及机号对照表.................
- rem 00-19-5b-32-64-da 192.168.1.1 JIN001
- rem 00-19-5b-32-63-db 192.168.1.2 JIN002
- rem 00-19-5b-32-65-08 192.168.1.3 JIN003
- rem 00-19-5b-2e-f7-75 192.168.1.4 JIN004
- rem 00-E0-81-02-1C-B0 192.168.1.5 JIN005
- rem 00-19-5b-2e-f7-67 192.168.1.6 JIN006
- rem 00-0e-0c-c2-ae-cd 192.168.1.7 JIN007
- rem 00-50-09-00-05-4b 192.168.1.8 JIN008
- rem 00-E0-A0-0A-14-A4 192.168.1.9 JIN009
- rem ......
- rem .........................................................
- rem 脚本开始:
- for /f "tokens=12 delims= " %%a in ('ipconfig /all^|find /i "Physical Address"') do set local_mac=%%a
- for /f "tokens=3,4 delims= " %%a in ('find /i "%local_mac%" %~dpnx0') do (
- set local_ip=%%a
- set local_name=%%b
- )
- rem 以上是获取本机IP及预设机号.
- if not defined local_ip (
- echo.
- echo.
- echo.
- echo 本机现在的MAC地址与原MAC地址有差异,请手动输入!
- echo.
- set /p local_ip= 请输入IP:
- set /p local_name= 请输入计算机名:
- goto :start_
- )
- rem 以上是在主板被更换之后MAC地址有差异的情况下的手动输入.
- :start_
- netsh interface ip set address name="100" source=static addr=%local_ip% mask=255.255.254.0 gateway=192.168.0.249 gwmetric=0
- netsh interface ip set dns name="100" source=static addr=192.168.0.249
- netsh interface ip add dns name="100" addr=202.96.128.68 index=2
- rem 以上是设置本机IP、子网掩码、网关等,请根据具体情况修改.
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %local_name% /f
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %local_name% /f
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %local_name% /f
- rem 以上是设置本机计算机名亦或机号.
-
- rem .......
- copy "D:\Soft\XYgam\pubwin\聊天区\dlglock.jpg" "C:\Program Files\HintSoft\PubwinClient\SKINS\" /y
- regedit /s C:\WINDOWS\system32\chyooy\2\聊天区.reg
- regedit /s D:\Soft\XYgam\data\桌面\聊天区.reg
- rem 如果母盘分类的话(聊天区一个母盘,高端区一个母盘)就不用判断,否则应该判断本机是属于高端区还是其它区.
- xcopy C:\WINDOWS\system32\Chyooy\2\PubwinClient.lnk "F:\system\「开始」菜单\程序\启动\"
- xcopy C:\WINDOWS\system32\Chyooy\2\pubwin.lnk "F:\system\「开始」菜单\程序\启动\"
- shutdown -r -t 5
- rem 以上是其他命令,请根据具体情况修改.
- del %0 /q
- rem 删除自身
-
复制代码
|