Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: A counter that counts in terms of seconds  (Read 3228 times)

0 Members and 1 Guest are viewing this topic.

nihad

  • Guest
A counter that counts in terms of seconds
« on: October 27, 2009, 03:29:52 AM »
Hi all,

Iam looking to write a batch file which can count in terms of seconds. Lets say start from 1 and go on till a conditiion when i want to stop it.

Can any help me with this???

Ryder17z



    Intermediate
  • Thanked: 2
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Re: A counter that counts in terms of seconds
« Reply #1 on: October 27, 2009, 05:52:31 AM »
Below is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.

TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL

Additionally, you could use the sleep ulity:

http://www.computerhope.com/download/utility/sleep.exe

Example code:
Code: [Select]
@echo off
echo Hello
echo.
sleep.exe 10
cls
pause

"10" is ten seconds
The cake is a lie...

Helpmeh



    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: A counter that counts in terms of seconds
« Reply #2 on: October 28, 2009, 04:50:26 AM »
BC, not every computer has choice.

@echo off
:loop
if exist file.txt goto cont
ping localhost -n 5 -w 1000>nul
goto loop
:cont
Echo File exists!
Pause >nul
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.