home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol13n05.zip / COUNT.ZIP / COUNTTYP.BAT < prev   
DOS Batch File  |  1994-02-09  |  1KB  |  32 lines

  1. @ECHO OFF
  2. REM COUNTTYP.BAT - counts the number of times it has been executed
  3. REM   with a particular command line parameter
  4.  
  5. REM ******************************************************************
  6. REM  This is a self modifing batch file.
  7. REM  Make a backup before running to prevent loss of time and effort.
  8. REM ******************************************************************
  9. SET datatype=none
  10. IF NOT '%1'=='' SET datatype=%1
  11.  
  12. REM The following line will increment the count.
  13. ECHO rem data - %datatype% >> COUNTTYP.BAT
  14.  
  15. IF NOT "%2" == "0" GOTO :skipinit
  16. REM The following line will initialize the file.
  17. FIND /I /V "data - %datatype%" < COUNTTYP.BAT > COUNTTYP.BAT
  18. :skipinit
  19.  
  20. REM The following lines will store the count in the environment.
  21. FIND /I /C "data - %datatype%" COUNTTYP.BAT > counttmp.bat
  22. ECHO SET count=%%2 > --------.BAT
  23. CALL COUNTTMP.BAT
  24. DEL COUNTTMP.BAT
  25. DEL --------.BAT
  26.  
  27. REM The following line will display the results.
  28. ECHO Current count of type "%datatype%" is: %count%
  29. SET datatype=
  30.  
  31. REM This is the start of the data.
  32.