CODE: [Copy to clipboard]
@echo %dbg% off&setlocal enabledelayedexpansion
:: code by qasa copyright@qknet 2:16 2007-7-26
title 自动改IP(自设重启次数) 作者:钟其栋
mode con cols=50 lines=10&color a
if not exist 次数.txt goto st_
if exist c:\ip\key.txt goto OK
if not exist 设置.txt goto do_
set /p sum_=<次数.txt
for /l %%i in (!sum_!,-1,1) do (
if exist c:\ip\off%%i.txt goto end
)
exit /b
:st_
del /q c:\ip\*.txt >nul 2>nul
set /p sum_=你准备重启电脑多少次后安装冰点(建议设2次以上)?
echo %sum_% >次数.txt
cd %USERPROFILE%\「开始」菜单\程序\启动\
copy c:\ip\ippp.lnk . >nul 2>nul
cd c:\ip\
echo.&echo 请重启进行系统备份! ! !
ping/n 7 127.1>nul
goto :eof
:do_
setlocal enabledelayedexpansion
set no_=0
cd.>设置.txt
for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do (
set mac=%%i
set mac=!mac:~0,-1!
)
for /f "tokens=1-3 delims==|" %%j in (MAC.INI) do (
set mac_=%%j
set ip_=%%k
set sm_=%%l
if !mac! equ !mac_! (
call :set_ !mac_! !ip_! !sm_!
set /a no_+=1
)
)
if "!no_!"=="0" (
echo.&echo MAC.ini中没有此机的MAC地址,将发送到工作机上......
echo %date% %time%新发现的MAC地址:>>NewMAC.ini&echo !mac! >>NewMAC.ini
echo %date% %time%新发现的MAC地址:>>\\游戏主机\full$\NewMAC.ini&echo !mac! >>\\游戏主机\full$\NewMAC.ini
echo.&echo 已经发送到工作机! ! !
del /q c:\ip\次数.txt
)
goto :eof
:set_
set /p w=<次数.txt
if %w% equ 1 cd.>c:\ip\key.txt&&start shutdown -r -t 90 -c 现在是第1次重启_最后一次重启_下次将安装冰点。作者:qasa
if %w% neq 1 start shutdown -r -t 90 -c 现在是第1次重启。
cd.>c:\ip\off2.txt
echo %1 %2 %3
set yy_=%3
echo.&echo 正在为%yy_:~1,3%号设置IP、机号...... 请稍候
for /f "tokens=1-4 delims==|" %%e in (DNS.ini) do (
set dns1_=%%e
set dns2_=%%f
set workgate_=%%g
set zwym_=%%h
)
for /f "tokens=1 delims=" %%s in ('ipconfig /all^|find /i "Ethernet adapter"') do (set ss_=%%s)
set ss_=%ss_:~17,-2%
for /l %%w in (1,1,2) do (
netsh interface IP Set Address "%ss_%" Static %2 %zwym_% %workgate_% 1 >nul
)
netsh interface IP Set Dns "%ss_%" static %dns1_% >nul
netsh interface ip add dns "%ss_%" %dns2_% >nul
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName /v "ComputerName" /t REG_SZ /d %3 /f >nul 2>NUL
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v "ComputerName" /t REG_SZ /d %3 /f >nul 2>NUL
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v "Hostname" /t REG_SZ /d %3 /f >nul 2>NUL
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v "NV Hostname" /t REG_SZ /d %3 /f >nul 2>NUL
echo.&echo 设置完毕
goto :eof
:end
setlocal EnableDelayedExpansion
set /p summ_=<次数.txt
set /p ss=<次数.txt
set /a sss=ss
for /l %%i in (!summ_!,-1,1) do (
if exist c:\ip\off%%i.txt (
set /a a=%%i
if exist c:\ip\off!sss!.txt (
start shutdown -r -t 60 -c 现在是第!a!次重启_最后一次重启_下次将安装冰点。作者:qasa
cd.>c:\ip\key.txt
goto :eof
)
start shutdown -r -t 60 -c 现在是第!a!次重启。
set/a b=a+1
cd.>c:\ip\off!b!.txt
goto :eof
)
)
goto :eof
:OK
cd %USERPROFILE%\「开始」菜单\程序\启动\
del /q ippp.lnk
cd c:\ip\
del /q c:\ip\*.txt
start "" df /install
goto :eof
现附上源代码给大家学习指正,里面并附上了使用说明一份。