Computing.Net > Forums > Programming > Loop + Increment

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Loop + Increment

Reply to Message Icon

Name: buee
Date: September 26, 2008 at 13:33:20 Pacific
OS: Windows XP SP3
CPU/Ram: P4 3.0GHZ 2GB PC5300
Product: HP POS
Comment:

I'm trying to set up a batch script that will produce a beep every 5 minutes for 30 minutes. I want to embed it inside a loop so I can use Ctrl+Break for convenience. Basically, the script will beep twice, wait 5 minutes, beep twice again, etc. until it hits the 30 minute mark. I already have the command to make it beep, wait 5 minutes, beep. But I need the syntax for the loop, increment, and variable setting.

The Buee has arrived



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: September 26, 2008 at 14:39:08 Pacific
Reply:

If you just have on hand the command to beep and wait, the loop is set up as

for /L %%j in (1 1 6) do (
your_command
)

The above statement repeats six times the command(s) between the ().


0

Response Number 2
Name: lee123abc
Date: September 30, 2008 at 07:26:09 Pacific
Reply:

Buee.... what is your code for that if I may ask?
I don't know if I am allowed to ask, in which case I appologise. It just interests me how you got a 5 minutes timer and a beep. I have something kind of close to a second timer, but by no means accurate.

Thank you


0

Response Number 3
Name: buee
Date: September 30, 2008 at 13:08:23 Pacific
Reply:

The wait command is ping 0.0.0.1 -n 1 -w 300000. It's the ghetto way of doing it since Microsoft keeps crippling their software. It basically pings a non-existant address once and waits 300000 ms for a response. The easy way to do it is drop the last 3 0's and then divide the remainder by 60 and that's what you have in minutes. I would post my code but it's a cluster right now and it's really long.

The Buee has arrived


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Exporting Clarion files f... javascript question



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Loop + Increment

FOR loops in C www.computing.net/answers/programming/for-loops-in-c/8449.html

FOR loops & Character Display in C www.computing.net/answers/programming/for-loops-amp-character-display-in-c/8438.html

C lang Infinite loops www.computing.net/answers/programming/c-lang-infinite-loops/3774.html