2005/08/07 | [原创]Ghost 以后自动修改 机器名,IP地址!( 。bat 版)
类别(电脑维修经验_软件技巧) | 评论(0) | 阅读(655) | 发表于 13:42
@echo off

:::--------------------------------------------------------------------------
:::::请你在使用把[MacAddress] 字段下 改为你自己的机器配置:::::::::
:::::此文件,只在win2k 专业版下 测试过:::::::::::::
:::::带有“::::” 后面的语句为 注释::::::::::
:::::因为会修改你的机器配置。请在测试机器上使用!:::::
:::---------------------------------------------------------------------

@cls :::清屏
@echo [ComputerName] [MacAddress] [IPAddress] [CS-CDKey] >config.cfg
@echo Nh005 00-11-5B-CF-C8-12 192.168.0.5 3245164654063 >>config.cfg
@echo Nh006 00-11-5B-BD-2F-E4 192.168.0.6 3385636230783 >>config.cfg
@echo Nh007 00-11-5B-B3-F0-86 192.168.0.7 2030698167302 >>config.cfg
@echo Nh008 00-11-5B-C8-C8-E1 192.168.0.8 7149496192146 >>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:
cdcd %USERPROFILE%\「开始」菜单\程序\启动
del /q *.*
-------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------

把此内容 粘贴到 记事本里。另存为 “1。bat” 批处理文件。在做ghost 镜像时
放到启动组里!
有什么问题 请联系 : QQ:233002600

E--mail : digsea2000@163.com
0

评论Comments