|
楼主 |
发表于 2008-3-19 18:33:58| 字数 4,128| - 中国–广东–深圳 电信
|
显示全部楼层
在霏凡论坛上的回复
config.bat 文件
- @echo on
- cls
- @set config=C:\UPDATE\PCMACIP.txt
- @set regfile=C:\UPDATE\config.reg
- @set macfile=C:\UPDATE\mac.txt
- ::设置配置文件路径
- @ipconfig/all | find "Physical Address" > %macfile%
- @for /f "tokens=12" %%M in (%macfile%) do @set strMac=%%M
- @echo MAC:%strMac%
- ::确定MAC地址
- @for /f "skip=2 tokens=1" %%N in ('find "%strMac%" %config%') do @set ComputerName=%%N
- @echo PC:%ComputerName%
- ::确定计算机名称
- @for /f "skip=2 tokens=3" %%I in ('find "%strMac%" %config%') do @set IPAddress=%%I
- @echo IP:%IPAddress%
- ::确定IP地址
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName] >> %regfile%
- @echo "ComputerName"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName] >> %regfile%
- @echo "ComputerName"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters] >> %regfile%
- @echo "NV Hostname"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog] >> %regfile%
- @echo "NV Hostname"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\ComputerName\ComputerName] >> %regfile%
- @echo "ComputerName"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog] >> %regfile%
- @echo "NV Hostname"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName] >> %regfile%
- @echo "ComputerName"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName] >> %regfile%
- @echo "ComputerName"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >> %regfile%
- @echo "NV Hostname"="%ComputerName%" >> %regfile%
- @echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog] >> %regfile%
- @echo "NV Hostname"="%ComputerName%" >> %regfile%
- ::追加计算机名称信息到注册表文件
- @echo [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run] >> %regfile%
- @echo "SetIP"=- >> %regfile%
- ::追加取消开机启动选项,达到只运行一次的目的
- @regedit /s %regfile%
- ::应用注册表文件
- @netsh interface ip set address name="本地连接" source=static addr=%IPAddress% mask=255.255.255.0 gateway=10.1.68.254 gwmetric=1
- @netsh interface ip add dns "本地连接" addr=202.96.64.68
- ::修改IP地址、子网掩码、网关和DNS设置
- @del %macfile%
- @del %regfile%
- @del %config%
- @del C:\UPDATE\config.bat
- ::删除过程文件
复制代码
config.reg
预设的注册表信息,如这里设置的是代理服务器的信息。
- Windows Registry Editor Version 5.00
- [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
- "ProxyEnable"=dword:00000001
- "ProxyServer"="gopher=10.1.96.12:8080;http=10.1.96.12:8080;https=10.1.96.12:8080;socks=10.1.96.12:1080"
- "ProxyOverride"="10.1.*;<local>"
- [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]
- "DefaultConnectionSettings"=hex:3c,00,00,00,0b,00,00,00,03,00,00,00,57,00,00,\
- 00,67,6f,70,68,65,72,3d,31,30,2e,31,2e,39,36,2e,31,32,3a,38,30,38,30,3b,68,\
- 74,74,70,3d,31,30,2e,31,2e,39,36,2e,31,32,3a,38,30,38,30,3b,68,74,74,70,73,\
- 3d,31,30,2e,31,2e,39,36,2e,31,32,3a,38,30,38,30,3b,73,6f,63,6b,73,3d,31,30,\
- 2e,31,2e,39,36,2e,31,32,3a,31,30,38,30,0e,00,00,00,31,30,2e,31,2e,2a,3b,3c,\
- 6c,6f,63,61,6c,3e,00,00,00,00,00,00,00,00,00,00,00,00,80,03,97,99,3c,ff,c7,\
- 01,01,00,00,00,0a,01,62,50,00,00,00,00,00,00,00,00
- "SavedLegacySettings"=hex:3c,00,00,00,f6,00,00,00,03,00,00,00,57,00,00,00,67,\
- 6f,70,68,65,72,3d,31,30,2e,31,2e,39,36,2e,31,32,3a,38,30,38,30,3b,68,74,74,\
- 70,3d,31,30,2e,31,2e,39,36,2e,31,32,3a,38,30,38,30,3b,68,74,74,70,73,3d,31,\
- 30,2e,31,2e,39,36,2e,31,32,3a,38,30,38,30,3b,73,6f,63,6b,73,3d,31,30,2e,31,\
- 2e,39,36,2e,31,32,3a,31,30,38,30,0e,00,00,00,31,30,2e,31,2e,2a,3b,3c,6c,6f,\
- 63,61,6c,3e,00,00,00,00,00,00,00,00,00,00,00,00,80,03,97,99,3c,ff,c7,01,01,\
- 00,00,00,0a,01,62,50,00,00,00,00,00,00,00,00
复制代码 |
|