Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a bacth file that works for most OS's but doesnt for 98 for NSLOOKUP
Any assistance is appreciated
[code]
cls
@ECHO OFF
echo Revised July 13, 2008
echo This will either modify your hosts for new server additions
echo or remove them when it asks you.
echo.
if Windows_NT == %OS% goto not9x
REM Your OS must be 9x or ME
echo You are running an old OS download and run evohosts9x.bat
pause
goto done:not9x
REM %SystemRoot% determines if 2000 or XP/Vista
set op_sys=NT
set hosts_dir=%SystemRoot%\system32\drivers\etc
cd %hosts_dir%:create_old
REM This section removes any evo servers added prior and creates hosts.old
echo Creating hosts.old removing any evo server additionsSETLOCAL
SET replace=
IF exist hosts.old DEL hosts.old
FOR /F "tokens=*" %%i IN (HOSTS) DO (
echo %%i | find /V "4x4evolution.com" >> hosts.old
)
echo hosts.old created
echo.
goto xphosts:getip
REM This section gets current IP for tonkas.no-ip.org
echo.
echo Getting IP for Tonka's web to add to hosts
echo.
rem SETLOCAL
SET SCRIPTNAME=%~n0
echo You might get a couple errors, something like:
echo *** Can't find server name for address
echo and
echo *** Default servers are not available.
echo That's ok as long as you get New IP is
echo.
set %%I = tonkas.no-ip.org
FOR /F "tokens=3 delims=: " %%I IN ('PING -n 1 tonkas.no-ip.org ^| FIND "Reply from"') DO (
SET IP=%%I
FOR /F "tokens=2 delims=:" %%J IN ('NSLOOKUP %%I ^| FIND "Address: "') DO SET DNS=%%J
)
IF NOT DEFINED IP @ECHO %1 is invalid or NETWORK error occurred. && GOTO :EOF
@ECHO.
IF NOT DEFINED DNS @ECHO %1 - invalid DNS name or DNS error occurred. && GOTO :EOF
call set IP=%%DNS:~2,99%%
echo new IP is %IP%
echo.
rem ECHO%DNS%
pause:create_new
REM This section creates hosts.new by copying hosts.old to it
REM So we can add the new stuff to ip prior to updating hosts
copy hosts.old hosts.new>nul
rem echo hosts.new created before adding the new hosts
rem echo.
rem pause:add2hosts
REM This section adds the new innfo to the hosts.new
REM There are actually 5 masters skipped on incase the IP changed
REM Which will cause only the TRI servers to show
REM Then copies then overwrites hosts with this hosts.new
echo %IP% master.4x4evolution.com>>hosts.new
echo %IP% master2.4x4evolution.com>>hosts.new
echo %IP% master3.4x4evolution.com>>hosts.new
echo %IP% master4.4x4evolution.com>>hosts.new
copy hosts.new hosts>nul
del hosts.new
goto :EOF:xphosts
REM This section asks if you just want to use the hosts.old or not
echo Use the hosts file that has evo server mods? (y/n)
echo Answering n will remove all evo server mods
set choice=
set /p choice=Type y or n for choice.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='n' goto useold
if '%choice%'=='N' goto useold
if '%choice%'=='y' goto getip
if '%choice%'=='Y' goto getip
echo "%choice%" is not valid please try again
echo.
goto xphosts:useold
copy hosts.old hosts>nul
echo All evo server additions were removed
pause
goto :EOF:done
[/code]

"You are running an old OS download and run evohosts9x.bat"
So where is that?
=====================================
If at first you don't succeed, you're about average.M2

the evohosts9x.bat only does the
echo %IP% master.4x4evolution.com>>hosts.new
echo %IP% master2.4x4evolution.com>>hosts.new
echo %IP% master3.4x4evolution.com>>hosts.new
echo %IP% master4.4x4evolution.com>>hosts.newand since I have a dynamic ip i have to edit it each time my ip changes, so was hoping to have it all in 1 batch file

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |