赞
踩
这个批处理文件,在电脑装好后,可以全自动改IP,子网掩码,网关和计算机名!但就是不能改DNS和备用DNS!
请哪位高手改一下,使其功能更完善!谢谢!!(有需要的也可以下载用,很不错的)
文件附后:
文件@echo off
:::--------------------------------------------------------------------------
:::::请你在使用把[MacAddress] 字段下
改为你自己的机器配置:::::::::
:::::此文件,只在win2k专业版下测试过
XP已经通过测试::::::::::::
:::::带有“::::” 后面的语句为 注释::::::::::
:::::因为会修改你的机器配置。请在测试机器上使用!:::::
:::---------------------------------------------------------------------
@cls :::清屏
@echo [ComputerName] [MacAddress] [IPAddress] [CS-CDKey]
>config.cfg
@echo D178 00-0A-EB-A8-5A-4B 192.168.1.178 7149496192150 >>config.cfg
@echo D179 00-15-F2-21-C7-CC 192.168.1.179 7149496192151 >>config.cfg
@echo D180 00-15-F2-1F-71-19 192.168.1.180 7149496192152 >>config.cfg
@echo D181 00-15-F2-21-C7-8B 192.168.1.181 7149496192153 >>config.cfg
@echo D182 00-15-F2-21-BA-8E 192.168.1.182 7149496192154 >>config.cfg
@echo D183 00-15-F2-21-C8-11 192.168.1.183 7149496192155
>>config.cfg :::::::添加你自己的机器配置
::::获取机器的TCP/IP 配置
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
:::分离出机器的物理地址,并保存到 ( phyaddr.txt) 文件中
if exist phyaddr.txt del phyaddr.txt
find "Physical Address" ipconfig.txt >phyaddr.txt
::::从(c:\phyaddr.txt)文件中取得物理地址字符串,并赋给变量"MacAddress"
for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set
strMac=%%M
:::显示物理地址字符串
@echo %strMac%
::::以变量"strMac"为关键字搜索(Config.cfg)中相同的字符串行,并保存到(ComputerCfg.txt)
find "%strMac%" Config.cfg >ComputerCfg.txt
::::显示机器名. (从"ComputerCfg.txt"中分离出
机器名字段,并赋给变量"ComputerName")
for /f "skip=2 tokens=1" %%N in (ComputerCfg.txt) do set
ComputerName=%%N
@echo %ComputerName%
::::显示IP地址. (从"ComputerCfg.txt"中分离出
IP地址字段,并赋给变量"IPAddress")
for /f "skip=2 tokens=3" %%I in (ComputerCfg.txt) do set
IPAddress=%%I
@echo %IPAddress%
::::显示网卡MAC地址.(从"ComputerCfg.txt"中分离出
MAC地址字段,并赋给变量"MacAddress")
for /f "skip=2 tokens=2" %%M in (ComputerCfg.txt) do set
MacAddress=%%M
@echo %MacAddress%
for /f "skip=2 tokens=4" %%C in (ComputerCfg.txt) do set
strCdkey=%%C
@echo %strCdkey%
::::创建注册表文件
@echo Windows Registry Editor Version 5.00
>ComputerName.reg
@echo
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName]
>>ComputerName.reg
::::用变量"%ComputerName%"去替换实际的机器名
@echo "ComputerName"="%ComputerName%"
>>ComputerName.reg
@echo
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
>>ComputerName.reg
::::用变量"%ComputerName%"去替换实际的机器名
@echo "NV Hostname"="%ComputerName%" >>ComputerName.reg
@echo "Hostname"="%ComputerName%" >>ComputerName.reg
::::修改 CS-CDKEY 不用管它
@echo
[HKEY_CURRENT_USER\Software\Valve\CounterStrike\Settings]>>ComputerName.reg
@echo "Key"="%strCdkey%">>ComputerName.reg
@echo
[HKEY_USERS\S-1-5-21-839522115-507921405-2146800195-500\Software\Valve\CounterStrike\Settings]>>ComputerName.reg
@echo "Key"="%strCdkey%">>ComputerName.reg
::::导入注册表文件。用的时候把" :: " 去掉
regedit /s ComputerName.reg
::::修改IP 地址。用变量"%IPAddress%" 去替换实际的IP 地址
netsh interface ip set address name="本地连接" source=static
addr=%IPAddress% mask=255.255.255.0 gateway=192.168.0.1
gwmetric=1
::::重起机器批处理!
setlocal
cd/d %temp%
echo [version] > reboot.inf
set inf=InstallHinfSection DefaultInstall
echo signature=$chicago$ >> reboot.inf
echo [defaultinstall] >> reboot.inf
rundll32 setupapi,%inf% 1 %temp%\reboot.inf
del reboot.inf
c:
cd %USERPROFILE%\「开始」菜单\程序\启动
del /q IP.bat
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。