How To Ping A Printer Every X Minutes?

Dell / Inspiron one 2320
November 28, 2018 at 16:11:24
Specs: Windows 7, 3.3 GHz / 4001 MB
Background:

I have an Epson printer that sometimes loses its wifi connection to my PC after it has not been used for a few hours. This seems to be a common problem with the WorkForce series. It doesn't always happen, but when I find that it will not print, I can usually "wake it up" by pinging it a few times. Sometimes it takes 2 or 3 tries, but once it responds to the ping, it then reacts to print requests just fine.

Pinging it doesn't actually wake up the physical printer, it just re-establishes the connection so that it will actually wake up (i.e. touchscreen turns on) when I print to it.

My Possible Solution:

Ping the printer every 15 minutes via a bat file:

:begin ping 192.168.0.2 sleep 900 goto :begin

However, I don't know if this is a good idea or not. I don't want to test it because I don't know how to stop the bat file once I kick it off. (I haven't done anything bat related in many, many years.) Obviously, I'll want to keep using my computer, so if this is going to keep interrupting me, that's not good either.

I'm certainly open to other suggestions. Thanks!

message edited by DerbyDad03


See More: How To Ping A Printer Every X Minutes?

Reply ↓  Report •

#1
November 29, 2018 at 00:54:07
@echo off&for /l %%a in () do (echo %time:~0,-3%:&ping -n 10 192.168.0.2&timeout 900 /NOBREAK)

close the window to stop the.bat :)

save as pingprinter.bat

I can make it run invisible& start at startup if you want(toggle-able through task manager)

als have you tried logging in to the web interface via the browser@192.168.0.2?


i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-30 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1415Mhz core@1.2v/1920MHz

message edited by hidde663


Reply ↓  Report •

#2
December 3, 2018 at 15:22:20
Sorry for the delay. I've been out of town/away from my printer for a few days so I couldn't try anything.

I just tried the browser access. The "site was unreachable" until guess when? Until I pinged the printer via the command line. If nothing else, I've proved the ping is definitely the wake up call for the device.

As far as the batch file you suggested, it certainly seems a lot more complicated than mine. Would you mind explaining it so I know what's going on?

Thanks!

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •

#3
December 4, 2018 at 01:58:28
sure, a line with :: infront is explanation of the line above:

@echo off
::hide output from user & speed up execution.

for /l %%a in () do
::loop for (start, step, end), but i left it empty, so there is no way for the loop to end :)

(echo %time:~0,-3%:
::for every loop do:
::echo %time:~0,-3%:, means print the windows variable %time% to the screen ,from character 0 till ::the end, but remove the last 3 characters.
::example: echo time=%time%
::time=10:51:32
:: just using it as visual indicator that the script is working, as the prompt does not display naything else, because of the @echo off.

&ping -n 10 192.168.0.2

::The & means also execute the trailing command
::ping -n 10 means ping the ip adress 10 times, (default is 4, so if i wrote ping 192.168.0.2, it would ::ping 4 times)

&timeout 900 /NOBREAK)
::The & again means also execute the trailing command
:: timeout 900 /NOBREAK, is basically what you meant with "SLEEP 900"
:: and /NOBREAK means you cannot accidentally break the timeout script without pressing CTRL+C

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-30 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1415Mhz core@1.2v/1920MHz


Reply ↓  Report •

Related Solutions

#4
December 4, 2018 at 19:09:02
Thanks for the explanation.

re:

@echo off
::hide output from user & speed up execution.

And yet I see it all. Also note that the Time does not appear to be updating. I shortened the delay to 30 seconds just to test it. Ran it for over 2 minutes with no update to the Time.

21:55:44:

Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: bytes=32 time=91ms TTL=64
Reply from 192.168.0.2: bytes=32 time=110ms TTL=64
Reply from 192.168.0.2: bytes=32 time=39ms TTL=64
Reply from 192.168.0.2: bytes=32 time=58ms TTL=64
Reply from 192.168.0.2: bytes=32 time=77ms TTL=64
Reply from 192.168.0.2: bytes=32 time=99ms TTL=64
Reply from 192.168.0.2: bytes=32 time=20ms TTL=64
Reply from 192.168.0.2: bytes=32 time=1ms TTL=64
Reply from 192.168.0.2: bytes=32 time=66ms TTL=64
Reply from 192.168.0.2: bytes=32 time=89ms TTL=64

Ping statistics for 192.168.0.2:
    Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 110ms, Average = 65ms

Waiting for  0 seconds, press CTRL+C to quit ...
21:55:44:

Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: bytes=32 time=53ms TTL=64
Reply from 192.168.0.2: bytes=32 time=75ms TTL=64
Reply from 192.168.0.2: bytes=32 time=201ms TTL=64
Reply from 192.168.0.2: bytes=32 time=18ms TTL=64
Reply from 192.168.0.2: bytes=32 time=40ms TTL=64
Reply from 192.168.0.2: bytes=32 time=62ms TTL=64
Reply from 192.168.0.2: bytes=32 time=83ms TTL=64
Reply from 192.168.0.2: bytes=32 time=106ms TTL=64
Reply from 192.168.0.2: bytes=32 time=28ms TTL=64
Reply from 192.168.0.2: bytes=32 time=50ms TTL=64

Ping statistics for 192.168.0.2:
    Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 18ms, Maximum = 201ms, Average = 71ms

Waiting for 24 seconds, press CTRL+C to quit ...


message edited by DerbyDad03


Reply ↓  Report •

#5
December 5, 2018 at 00:34:17
@echo off&for /l %%a in () do (echo %time:~0,-3%&ping -n 10 192.168.0.2 >nul&timeout 900 /NOBREAK >nul)

adding some >nul's should fix that

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-30 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1415Mhz core@1.2v/1920MHz

message edited by hidde663


Reply ↓  Report •

#6
December 7, 2018 at 18:16:54
The time still wasn't updating, so instead of displaying the time, I decided to display a counter.

I took what you taught me, did a little research on my own and came up with this. Let me know if you see any problems with it. (For testing purposes, it's set for 15 seconds)

@echo off
set r=0
:PingRun
 set /a r=r+1
 echo Ping Run Complete %r%
 ping -n 10 192.168.0.2 >nul
 timeout 15 /NOBREAK >nul
goto PingRun

message edited by DerbyDad03


Reply ↓  Report •

Ask Question