我有一个批处理,可以改机房70台电脑的ip和机器名。但是只能在xp系统下用,win7系统不能用。哪位大侠能帮忙改下,不胜感激!!!!!!- @color c
- @cls
- @echo [ComputersMAC] [Name] [ip] >name.xmz
- @echo 74-27-EA-34-02-CB A01 111 >>name.xmz
- @echo 74-27-EA-16-50-18 A02 112 >>name.xmz
-
-
-
- @cls
-
- ipconfig /all >ipconfig.xmz
-
- find "Physical Address" ipconfig.xmz >mac.xmz
-
- for /f "skip=1 tokens=12" %%C in (mac.xmz) do set mac=%%C
-
- find "%mac%" name.xmz >key.xmz
-
- for /f "skip=1 tokens=2" %%C in (key.xmz) do set name=%%C
-
- for /f "skip=1 tokens=3" %%C in (key.xmz) do set ip=%%C
-
- @echo %name%
-
- @echo %ip%
-
- @echo Windows Registry Editor Version 5.00 >Cname.reg
-
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName] >>Cname.reg
-
- @echo "ComputerName"="%name%" >>Cname.reg
-
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >>Cname.reg
-
- @echo "NV Hostname"="%name%" >>Cname.reg
-
- @echo "Hostname"="%name%" >>Cname.reg
-
- @echo Windows Registry Editor Version 5.00 >insn.reg
-
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >>insn.reg
-
- @echo "VirtualNetworkNumber"=dword:00000%name% >>insn.reg
-
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters] >>insn.reg
-
- @echo "VirtualNetworkNumber"=dword:00000%name% >>insn.reg
-
- regedit /s Cname.reg
- regedit /s insn.reg
-
- netsh interface ip set address name="本地连接" source=static addr=192.168.7.%ip% mask=255.255.255.0 gateway=192.168.7.1 gwmetric=0
-
- netsh interface ip set dns name="本地连接" source=static addr=202.99.192.68
- netsh interface ip add dns name="本地连接" addr=202.99.192.66 index=2
-
- del /q *.xmz
- del /q *.reg
-
- shutdown -r -t 5
-
- del %0
复制代码 说明:1、XX-XX-XX-XX-XX-XX 这些就是要部署的机器MAC地址。
2、后面自己根据实际修改:gateway是网关、mask是子网掩码、addr就是IP(%IP%是根据前面的设置自动修改)。
要改成win7下使用!!!! |