Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for chkfdisk.cmd

(view source code of chkfdisk.cmd as plain text)

  1. @ECHO OFF
  2. REM ChkFdisk.cmd,  Version 2.00
  3. REM Written by Rob van der Woude
  4. REM Checks if OS/2 partition is active on bootup, and makes it active
  5. REM and reboots if not. Also deletes "illegal" swap file on RPL server
  6.  
  7. REM For RPL servers only:
  8. REM specify full path and name of swap file on RPL server
  9. SET SWAPFILE=Z:\OS2\SYSTEM\SWAPPER.DAT
  10. REM Otherwise:
  11. REM SET SWAPFILE=
  12.  
  13. REM Check if OS/2 partition is active (C:)
  14. FDISK /QUERY | FIND "C:" | FIND "OS/2" > NUL
  15. REM If not, set it active
  16. IF ERRORLEVEL 1 GOTO ChgAccess
  17. REM If active, remove swap file from RPL server if necessary
  18. IF NOT "%SWAPFILE%"=="" IF EXIST %SWAPFILE% DEL %SWAPFILE%
  19. GOTO End
  20.  
  21. :ChgAccess
  22. REM Toggle active partition
  23. FDISK /SETACCESS
  24. REM Check if it succeeded
  25. FDISK /QUERY | FIND "C:" | FIND "OS/2" > NUL
  26. REM If not, display error message
  27. IF ERRORLEVEL 1 GOTO Error
  28. REM Reboot if successfull
  29. SETBOOT /IBD:C:
  30. GOTO End
  31.  
  32. :Error
  33. REM Error message
  34. ECHO Error changing accessible partion:
  35. FDISK /QUERY
  36. PAUSE
  37.  
  38. :End
  39.  

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