1.

Solve : Program Counter -- Batch file??

Answer»

Hi folks -

I am looking to create a bat or EXE that can do the following:

Upon execution it will INCREMENT a counter and then reset at a designated time every night.

Thanks for all your help in advance.

[link removed. Please do not advertise on the forums]
Code: [SELECT]@echo off
set time=0
set mtime=0
:loop
cls
set /a time=%time% + 1
If %time%==60 (
set time=0
set /a mtime=%mtime%+1
)
If %mtime%==1 (
echo Runtime [%mtime% Minute and %time% Seconds]
ping 127.0.0.1 -n 2 > NUL
goto loop
)
echo Runtime [%mtime% Minutes and %time% Seconds]
ping 127.0.0.1 -n 2 > NUL
goto loop
)
pause

This was asked and answered the first time this question was posted.

Here

In CASE you missed it:

Code: [Select]@echo off
if not exist countfile echo 0 > countfile
set /p count=<countfile
set /a count += 1
echo %count% > countfile

To reset the file use the task scheduler to launch a file that pushes zero into the countfile: echo 0 > countfile

Sidewinder you da man! Thank you so much for your prompt response!Would this be something I could use to compare a file's modified date against the current date every 10 minutes? It looks like I would use the first IF clause, but I don't know enough to be sure what the commands are doing.

Quote from: Jacob on October 05, 2008, 01:50:34 PM

Code: [Select]@echo off
set time=0
set mtime=0
:loop
cls
set /a time=%time% + 1
If %time%==60 (
set time=0
set /a mtime=%mtime%+1
)
If %mtime%==1 (
echo Runtime [%mtime% Minute and %time% Seconds]
ping 127.0.0.1 -n 2 > NUL
goto loop
)
echo Runtime [%mtime% Minutes and %time% Seconds]
ping 127.0.0.1 -n 2 > NUL
goto loop
)
pause



Discussion

No Comment Found