Announcement

Collapse
No announcement yet.

Jfg

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jfg

    Just For Grins:

    While looking for something in my collection of All Basic Code stuff I found this beastie. It is almost 20 years old and still works. I had forgotten about batch files. If you want, save it as BEER.BAT, then click on it to run.

    :
    Code:
    :That TronDoc posted to the HotBasic forum.
    
    :Code:
    
    @echo off
    REM 99 Bottles of Beer in DOS Batch
    REM Gert-jan Los ([email protected])
    REM The file with batch program must be named as "beer.bat"
    REM Noted by Vladimir Vojacek ([email protected]), 2003-07-03
    
    if "%1"=="" goto outer
    if "%1"=="body" goto body
    :inner
    pause
    for %%a in ( 9 8 7 6 5 4 3 2 1 0 ) do call beer body %2 %%a
    goto exit
    
    :outer
    pause
    for %%a in ( 9 8 7 6 5 4 3 2 1 0 ) do call beer inner %%a
    goto exit
    
    :body
    set num=%2%3
    set bottle=bottles
    if "%num%"=="99" goto skipfirst
    if "%2"=="0" set num=%3
    if "%num%"=="1" set bottle=bottle
    echo %num% %bottle% of beer on the wall
    echo.
    if "%num%"=="0" exit
    :skipfirst
    echo %num% %bottle% of beer on the wall
    echo %num% %bottle% of beer
    echo take one down and pass it around
    :exit
     
    
    :So you actually can do something useful with a batch file  
    :
    Walt Decker
Working...
X