Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for driverdy.bat

(view source code of driverdy.bat as plain text)

  1. @ECHO OFF
  2. :: DRIVEReaDY  --  Check if drive A: is ready
  3. :: Written by Rob van der Woude
  4. :: Dependencies: Needs MS-DOS 6 or up, or OS/2 Warp 4
  5. ::               May or may not work on earlier OS versions,
  6. ::               that hasn't been tested yet
  7. ::
  8. :: Set initial value
  9. SET AREADY=
  10. :: Clean up old temporary files
  11. IF EXIST DRIVERDY.DAT DEL DRIVERDY.DAT
  12. IF EXIST DRIVERDY.TMP DEL DRIVERDY.TMP
  13. :: Check if drive A: is ready, redirect error message to temporary
  14. :: file, /F parameter automates "Fail" on Abort, Retry, Fail prompt
  15. COMMAND.COM /F /C DIR A: 1> NUL 2> DRIVERDY.DAT
  16. :: Copy temporary file; if zero bytes, copy will fail without error
  17. IF EXIST DRIVERDY.DAT COPY DRIVERDY.DAT DRIVERDY.TMP 1> NUL 2> NUL
  18. IF EXIST DRIVERDY.TMP SET AREADY= NOT
  19. :: Clean up temporary files
  20. IF EXIST DRIVERDY.DAT DEL DRIVERDY.DAT
  21. IF EXIST DRIVERDY.TMP DEL DRIVERDY.TMP
  22. :: Display result
  23. ECHO Drive A: is%AREADY% ready
  24.  

page last modified: 2024-04-16; loaded in 0.0104 seconds