MS-DOS Do While Loop

March 3, 2010 at 13:45:09
Specs: Windows

here is a solution to produce a Do While Loop in DOS Batch:


@REM initialize test value to be "true"
@SET intCounter=1

:while

@REM test condition
@IF %intCounter% GTR 10 (GOTO wend)

@REM procedure where condition is "true"
@echo %intCounter%

@REM set new test value
@SET /a intCounter=intCounter+1

@REM loop
@GOTO while

:wend


@PAUSE


See More: MS-DOS Do While Loop

Report •


#1
March 3, 2010 at 14:20:19

There is no GTR in DOS.

LOL


=====================================
Helping others achieve escape felicity

M2


Report •

#2
March 3, 2010 at 14:52:27

And then, somebody invented the command

@echo off


Report •

#3
March 3, 2010 at 18:25:59

yeah, i didn't think dos could do math in batch. had me going there for a minute!

Report •

Related Solutions

#4
March 3, 2010 at 18:41:14

yeah, i didn't think dos could do math in batch. had me going there for a minute!

Here's a counter that works in dos, the only external is choice.com(will work in windows but not with choice.exe....).

http://pastebin.com/TM5Skq6W



Report •

#5
March 3, 2010 at 21:32:46

Lol! yeah, that's great! at first, i though "i know i can figure it out without cheating...", then i thought "ok, i'll cheat" (view the code). Now I have not only cheated, but I will require some contemplative time to figure it out!
(no no! don't tell me how it works.. yet.. i've already cheated once..)
at least it wasn't a "one-liner", which is what is thought at first.

ps: i read that rodents can be driven off by high frequencies. I tried it once, but all i got was neighborhood dogs barking like hell! the mice just laughed. probly the wrong freq.


Report •

#6
March 5, 2010 at 01:32:17

Who actually runs DOS, these days, by the way ? To do WHAT exactly ?

Report •

#7
March 5, 2010 at 01:52:12

I plan to run it on my other box to generate tones in QBASIC.


=====================================
Helping others achieve escape felicity

M2


Report •

#8
March 5, 2010 at 01:56:29

Some people like to run old games and others are still trying to get the most out of custom hardware that controls machinery, run memory tests, ect.

Report •

#9
March 5, 2010 at 05:42:43

@m2:
Lol! yeah, SOUND is fun, and visbasic took all the fun out of it! (have you tried "beep?" yecch!!!)
i guess there's library import, similar to "sleep" that might make it work. I haven't found it yet though.
@judago: to me, DOS makes a great environment for experimentation and wreaking general bare-bones havoc.

Report •

#10
March 5, 2010 at 06:49:39

I can only remember one thing that was interesting, being some program that allowed to show the disk activity (like the led on your computer does) onto one of the unused leds of your keyboard. Since Windows, that didn't work anymore ...

And, indeed ... old games. But then I think about Commodore 64's ...


Report •

#11
March 5, 2010 at 09:10:05

Laugh all you want about DOS. I knew a guy who used his own trading program in Lotus 2.x and was making over $1000 a month trading penny stocks. [Back when that was a lot of money.]


=====================================
Helping others achieve escape felicity

M2


Report •

#12
March 5, 2010 at 15:42:43

I'm not laughing

Report •

#13
March 5, 2010 at 23:27:47

tvc: Who actually runs DOS, these days, by the way ? To do WHAT exactly ?
Some boot programs do; SpinRite, specifically.

Report •

#14
March 6, 2010 at 02:56:52

Interesting, but it says here ( http://en.wikipedia.org/wiki/SpinRite ) that you dont need DOS for that, although it works if that is your OS.

Many needs for DOS (these days) seem to involve alternative boot-up procedure, but that is what Linux-live-boot-stuff also tries to cover.

I also used DOS lately, but I had to find out that it does not like NTFS, so, if all of your disks are NTFS (which they should be if you are running XP or up), DOS is pretty useless, for any disk related action.


Report •

#15
March 6, 2010 at 09:43:08

tvc: you dont need DOS for that
That's because Free DOS is included on its boot image

Report •

#16
March 6, 2010 at 14:27:47

Yes, but does Knoppix run DOS ? Answer with yes or no will do.

Report •

#17
March 6, 2010 at 18:39:01

Knoppix, the Linux distro? I don't think so, no. But I haven't really dealt with it outside of a few Windows password resets.

Report •


Ask Question