home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / HARDDISK / OPTIDR.ZIP / SAMPLE.BAT < prev   
Encoding:
DOS Batch File  |  1989-08-14  |  2.5 KB  |  116 lines

  1. ECHO OFF
  2. CLS
  3. ECHO This batch file attempts to optimize drive C.
  4. ECHO  
  5. ECHO The following command performs directory optimization for
  6. ECHO drive C:
  7. ECHO  
  8. ECHO  
  9.  
  10. OPTdir C: /OD
  11.  
  12. ECHO  
  13. ECHO  
  14. ECHO Now, we need to test the errorlevel returned.  These codes
  15. ECHO must be tested from highest to lowest, or this batch file
  16. ECHO may not work properly.
  17. ECHO  
  18. ECHO  
  19.  
  20. IF ERRORLEVEL 27 GOTO USER_ABORT
  21. IF ERRORLEVEL 26 GOTO BAD_COMMAND
  22. IF ERRORLEVEL 10 GOTO DISK_CACHE
  23. IF ERRORLEVEL 8 GOTO CHECK_DISK
  24. IF ERRORLEVEL 7 GOTO NO_MEMORY
  25. IF ERRORLEVEL 6 GOTO FATAL_ERR
  26. IF ERRORLEVEL 4 GOTO NO_MEMORY
  27. IF ERRORLEVEL 3 GOTO VERIFY_DISK
  28. IF ERRORLEVEL 2 GOTO NO_DRIVE
  29. IF ERRORLEVEL 1 GOTO BAD_FAT
  30.  
  31. ECHO  
  32. ECHO No problems running OPTdir!
  33. GOTO BATCH_END
  34.  
  35. :BAD_COMMAND
  36. ECHO  
  37. ECHO OPTdir did not understand the command it was given.
  38. ECHO Please edit this batch file to correct the command
  39. ECHO before using it again.
  40. GOTO BATCH_PAUSE
  41.  
  42. :BAD_FAT
  43. ECHO  
  44. ECHO Either the FAT or the directories are bad.  Please run
  45. ECHO CHKDSK to try to fix them.
  46. ECHO  
  47. GOTO BATCH_PAUSE
  48.  
  49. :NO_DRIVE
  50. ECHO  
  51. ECHO The drive you specified was not available.  Please
  52. ECHO either modify this batch file to use the correct drive,
  53. ECHO or make sure that the drive is available before using
  54. ECHO OPTdir.
  55. GOTO BATCH_PAUSE
  56.  
  57. :VERIFY_DISK
  58. ECHO  
  59. ECHO OPTdir will attempt to fix your disk problems. Press
  60. ECHO any key to run OPTdir's Verify/Fix-Disk command.
  61. ECHO  
  62. PAUSE
  63. OPTdir C: /V
  64. IF ERRORLEVEL 27 GOTO USER_ABORT
  65. IF ERRORLEVEL 1 GOTO CANNOT_FIX
  66. GOTO RUN_CHECK
  67.  
  68. :NO_MEMORY
  69. ECHO  
  70. ECHO OPTdir needs either more RAM or more disk space available
  71. ECHO before it can operate on your system.
  72. GOTO BATCH_PAUSE
  73.  
  74. :FATAL_ERR
  75. ECHO  
  76. ECHO OPTdir encountered a fatal error.  You must manually use
  77. ECHO the Check-Disk command and/or the Verify/Fix-Disk command
  78. ECHO before OPTdir will operate from the batch file.
  79. ECHO  
  80. GOTO BATCH_PAUSE
  81.  
  82. :CHECK_DISK
  83. ECHO  
  84. ECHO Press any key to run Check-Disk to fix errors on drive C.
  85. ECHO  
  86. PAUSE
  87.  
  88. :RUN_CHECK
  89. ECHO  
  90. OPTDIR /C C:
  91. GOTO BATCH PAUSE
  92.  
  93. :DISK_CACHE
  94. ECHO  
  95. ECHO OPTdir sensed a dangerous type of disk caching with which
  96. ECHO it cannot successfully operate.  Please turn disk caching
  97. ECHO off before running OPTdir, or run OPTdir before your disk
  98. ECHO caching is activated
  99. ECHO  
  100. GOTO BATCH_PAUSE
  101.  
  102. :USER_ABORT
  103. ECHO  
  104. ECHO The user pressed the ESC key to terminate early!
  105. ECHO  
  106. GOTO :BATCH_PAUSE
  107.  
  108. :CANNOT_FIX
  109. ECHO  
  110. ECHO Sorry!  OPTdir could not completely fix the errors.
  111. ECHO  
  112.  
  113. :BATCH_PAUSE
  114. PAUSE
  115. :BATCH_END
  116.