Msdos Loop creation in batch file

March 28, 2012 at 00:46:53
Specs: Windows 7
I have this code in pings.bat file.

set _my_datetime=%date%_%time%
set _my_datetime=%_my_datetime: =_%
set _my_datetime=%_my_datetime::=%
set _my_datetime=%_my_datetime:/=_%
set _my_datetime=%_my_datetime:.=_%
ping -n 10 www.google.com > d:\pingresult_%_my_datetime%.txt

How can i set this command automaticly run hourly ?

Thanks.


See More: Msdos Loop creation in batch file

Report •

#1
March 28, 2012 at 04:35:35
Use task scheduler GUI, or command line: schtasks

When your only tool is a hammer, every problem looks like a nail.


Report •

#2
March 29, 2012 at 00:02:27
Hi Again,

I changed my mind. This code run and ping google.com 10 times and close itself now. But i want;

* ping google.com 10 times
* wait 5 seconds after first process complete.
* and run same process again until i stop it manually.

How can i edit this code for this ?

Thanks in advance.


Report •

#3
March 30, 2012 at 08:02:08
Seems wierd that you would want to ping google an infinate number of times, this feels a bit suspicious.

mike


Report •

Related Solutions

#4
March 30, 2012 at 08:13:17
:lablethingy
ping -n 10 www.google.com > d:\pingresult_%_my_datetime%.txt
waitfor /t 5 simon
goto lablethingy

might work though

mike


Report •

#5
March 30, 2012 at 08:17:15
Hi mikelinus

This code work but only one time. Not eter the loop. You can try yourself.

Thanks.


Report •

#6
March 30, 2012 at 08:56:54
PERHAPS
:lablethingy
ping -n 10 www.google.com > d:\pingresult_%_my_datetime%.txt
PING -n 7 127.0.0.1>nul
goto lablethingy

mike


Report •

Ask Question