This page has been robot translated, sorry for typos if any. Original content here.

Ping-script for maintaining Gprs connection

Скрипт-пинговалка для поддержания Gprs-соединения

Quite often, operators (and providers) offer cheap Internet - or even provide an anlim.

But at us all not as at people, it is simple so can not be happiness.

Often the connection is broken or "plugged" "sticks" (when the connection does not break, but the data does not go).

Anyone who encounters this problem will be helped by a simple script-pingovalochka.

Its meaning: periodically pings the address. In the absence of ping (when the channel is "stuck" or broken), reconnection occurs.

Running this script, you can be sure of maintaining the working capacity of the connection.


1. Create a cmd file in the notebook (for example, pinger.cmd) with the following contents:

 @echo off
 echo% date%% time% --- STARTED --- >> pinger.log
 set Try = 1

 rem All settings are in this block

 rem connection name
 set DialName = Life
 rem Login
 set Login = Login
 rem Password
 set Pass = Password
 rem ping timeout in ms
 set TimeOut = 10000
 rem number of ping attempts
 set MaxPing = 5
 rem pause in s
 set Pause = 30
 rem host address for ping
 set host =
 rem your phone number
 set PhoneNum = 80631234567

 : start
 echo start ping
 ping% host% -n 1 -w% TimeOut%
 if errorlevel = 1 goto bad
 goto ok

 : ping
 ping% host% -n 1 -w% TimeOut%
 if not errorlevel = 1 goto ok
 set / a Try =% Try% + 1
 if% Try% geq% MaxPing% goto bad
 goto ping

 : ok
 goto end

 : bad
 set / a Try = 1
 echo% date%% time% -!  Trouble, reconnect! - >> pinger.log
 rasdial% DialName% / disconnect
 rasdial% DialName% / phone:% PhoneNum%
 rasdial% DialName%% Login%% Pass%
 if errorlevel = 1 goto bad
 goto ping

 : end
 set / a Try = 1
 choice / C: PRDE / T: P, 30 / N Pause 30 seconds.  [P] ing [R] econnect [D] isconnect [E] xit?
 rem echo.
 rem echo.
 goto ping
 : 2
 goto bad
 : 3
 rasdial% DialName% / disconnect
 echo% date%% time% == Exit script == >> pinger.log

In the given file it is necessary to replace MANDATORY :

  • name of connection (set DialName = Life) [see name: Start - Settings - Network connections - name of your connection]
  • login / password (set Login = Login set Pass = Password) - if required to establish a connection

In the given file it is necessary to replace (if desired):

  • the host address that pings (set host =
  • ping timeout (set TimeOut = 10000)
  • the number of ping attempts (set MaxPing = 5) after which will reconnect
  • interval of connection check (set Pause = 30)

2. Next to pinger.cmd, put "" from the choise.rar archive.

3. Run and enjoy life - pingovalka will establish a connection and will maintain it in working order.

!!! Similar script "pinger" for Linux to maintain vydelenki

choise.rar (2.88 kilobytes) choise.rar (2.88 kilobytes) choise.rar (2.88 kilobytes) Virus Free by KAV (684 bytes) (684 bytes) (684 bytes) Virus Free by KAV