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
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.
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.
Summary: I've been trying to get a for loop to display a pattern of decreasing, left-indented characters for about 3 days now. The assignment is to write a menu-driven program to offer the choice of seeing one...
Summary: that is not a difficult task, but if is a homework question, then i reckon you should first make an attempt. you made the right decision by using a for loop. next, you'll need to make use of increment...
Summary: Your code doesn't add 1 then 2 then 3 etc. It increments both variables by one. Try this code: I have exchanged the less than and greater than symbols with square brackets, because of the the way the...