views:

68

answers:

3

I'm using net conn .which goes down after sum time bt if i repair my connection it works fine , i hv to do it manually always.... i want to do this task automatically. so i want to make a batch file in windows which will constantly running in background . and when my Internet network connection will down it will renew my connection and net will start again ... without any interaction

I want to do this task using windows batch file..

I only aware of this I've use

runas /user:local\administrator ipconfig /release ipconfig /flushdns ipconfig /renew

bt i don't know how to detect whether Network connection is down .. or up ?

Hoping for quick and positive response ..

Regards ..

Vishwanath D. Dalvi

A: 

The problem you must be trying to address is

Why your network connection is breaking after sometime

and not

How to repair your network connection every now and then

because if you are able to identify the root cause for first problem then you are done.

ckv
no I just want to know how to repair connection only when its down using batch file windows .. Why my network conn is down .. its nt always bt sumtimes.. it happens
A: 

You could try and ping a widely used service in your country (or ping google like crazy) to detect internet connectivity. it's not bullet proof, but will let you know when your internet is down (probably).

The result of pinging could be checked by batch/script and according to the result, decide whether you want to ipconfig /renew or not.

Yoni H
yeah same logic .. i hv decided to go with bt .. how to chk the results of ping .. is request time out .. and i don't want to renew connectin of 1 request time out .if der r 10 request time out in ping results then do the renew . bt i want to implement it using code .. ... help plzz
all I have for you are some pointers:you can run `ping` with -n to tell it how many times to try, and redirect the output to a file.you can use `for` in batch files to process the output file (more specifically `for /f`) and tell if you have timeouts or successful pings.
Yoni H
#Yoni thanks .. I will try for it.
@ECHO OFFipconfig /releaseipconfig /renewECHO.ECHO LAN IP REPAIRED.ECHO.PAUSECLSEXITI hv written .. this .. bt i don't know how to detect Request time out .. then only i want to call this batch file.
as I pointed out in my comment above, try `ping` redirected to a file, then have a read about in `help for`
Yoni H
A: 

f 'r sng Wndws r bv, cn tr ths:

fcnfg | grp -c "P ddrss"

Ths wll gv th nmbr f mtchng P drsss - n cs r cnnctn s dwn, 'll hv fwr thn nrmll.

'll nd grp fr ths (s t's nt prt f Wndws), bt t cn b btnd frm ths RL: nxtls.srcfrg.nt

Piskvor