标题: [讨论]批处理修改IP\计算机名\DNS\IPX等
[打印本页]
作者: jycel
时间: 2008-10-26 10:41
标题: [讨论]批处理修改IP\计算机名\DNS\IPX等
批处理如下:
@echo off
color 9f
Rasdial Router /DISCONNECT
cls
title 自动改IP,计算机名,网关,IPX,DNS
echo ---------------------------------------------------
echo 正在读取信息:
echo ---------------------------------------------------
rem :: 设置子网掩码 ::
set mask=255.255.255.0
rem :: 设置子网关 ::
set gateway=192.168.0.1
rem :: 设置首选DNS ::
set DNS1=218.6.200.139
rem :: 设置备用DNS ::
set DNS2=202.98.96.68
rem ---------------------------------------------------
rem 输出客户机列表
rem ---------------------------------------------------
if exist config.cfg del config.cfg
echo [计算机名] [Mac地址] [IP地址] [IPX编号] >config.cfg
echo 001 00-E0-61-15-C5-43 192.168.0.11 001 >>config.cfg
echo 002 00-E0-61-16-12-01 192.168.0.12 002 >>config.cfg
echo 003 00-E0-61-15-C8-DC 192.168.0.13 003 >>config.cfg
echo 004 00-E0-61-15-C7-4E 192.168.0.14 004 >>config.cfg
rem ---------------------------------------------------
rem 读取IPConFig
rem ---------------------------------------------------
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist phyaddr.txt del phyaddr.txt
find "Physical Address" ipconfig.txt >phyaddr.txt
for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set strMac=%%M
echo 读取MAC地址: %strMac%
echo 读取完成...
echo --------------------------------------------------
echo 当前应用设置:
echo ---------------------------------------------------
find "%strMac%" Config.cfg >ComputerCfg.txt
for /f "skip=2 tokens=1" %%N in (ComputerCfg.txt) do set pcname=%%N
echo 本机计算机名: A%pcname%
for /f "skip=2 tokens=3" %%I in (ComputerCfg.txt) do set myip=%%I
echo 本机IP地址: %myip%
echo 本机IPX地址: %pcname%
echo 子网掩码: %mask%
for /f "skip=2 tokens=2" %%M in (ComputerCfg.txt) do set mymac=%%M
echo 设定MAC地址: %mymac%
echo 开始应用设置......
echo 计算机名修改中......
echo Windows Registry Editor Version 5.00>ComputerName.reg
echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam]>>ComputerName.reg
echo @="A%pcname%">>ComputerName.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName]>>ComputerName.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName]>>ComputerName.reg
echo "ComputerName"="A%pcname%">>ComputerName.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName]>>ComputerName.reg
echo "ComputerName"="A%pcname%">>c:\TempInfo.reg>>ComputerName.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog]>>ComputerName.reg
echo "ComputerName"="A%pcname%">>ComputerName.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName]>>ComputerName.reg
echo "ComputerName"="A%pcname%">>ComputerName.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]>>ComputerName.reg
echo "NV Hostname"="A%pcname%">>ComputerName.reg
echo "Hostname"="A%pcname%">>ComputerName.reg
echo [HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\ShellNoRoam]>>ComputerName.reg
echo @="A%pcname%">>ComputerName.reg
regedit /s ComputerName.reg
del /q ComputerName.reg
echo 修改计算机器名称完成
echo Windows Registry Editor Version 5.00>ipx.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\NwlnkIpx\Parameters]>>ipx.reg
echo "VirtualNetworkNumber"=dword:%pcname% >>ipx.reg
regedit /s ipx.reg
del /q ipx.reg
echo IPX修改完毕
echo 修改IP中...
netsh interface ip set address name="本地连接" source=static addr=%myip% mask=%mask% gateway=%gateway% gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=%DNS1% register=PRIMARY
netsh interface ip add dns name="本地连接" addr=%DNS2%
netsh interface ip set wins name="本地连接" source=static addr=none
cls
echo 【%pcname%】号机配置如下:
echo 本机计算机名:A%pcname%
echo 本机IP地址为:%myip%
echo 本机IPX地址:%PCname%
echo 本机子掩网码:%mask%
echo 本机网关地址:%gateway%
echo 本机MAC地址:%strMac%
echo 首选DNS服务器:%DNS1%
echo 备用DNS服务器:%DNS2%
del /q ComputerCfg.txt
del /q config.cfg
del /q ipconfig.txt
del /q phyaddr.txt
echo 正在重启网卡,请稍等......
devcon disable *DEV_8169*
devcon enable *DEV_8169*
for /l %%a in (10,-1,0) do cls&echo/&echo %%a秒后安装还原软件&ping -n 2 127.1>nul
c:\KSHY\setup.exe /install /password:*** /protect:CDE
::shutdown -r -f -t 0
在网上找了很了很久修改分辩率的批处理都是借助"SETRES"才能办到!
批处理内容:
@echo off
SETRES h1024 v768 b32 f85
所有资料全是网上找的!
现在的问题就是怎么把这个修改分辩率的批处理加入到上面的批处理中
设置成,根据IP或计算机名来自动执行1024*768或1440*900分辩率!因为网吧有17和19的显示器!
───────────────── 版务记录 ─────────────────
执行:HAT
操作:[2008-10-26]代码加code标签;删除附件SETRES.rar
提示:为节约论坛空间,请勿重复上传附件,如需下载SETRES,请查看:
批处理室附件收集专用帖
───────────────── 版务记录 ─────────────────
[
Last edited by HAT on 2008-10-26 at 13:15 ]