home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / dfsee510.zip / dfsipart.cmd < prev    next >
OS/2 REXX Batch file  |  2003-01-14  |  3KB  |  110 lines

  1. @echo off
  2. rem                Sample script to create/restore PARTition images
  3. rem                instead of VOLume images like DFSIMAGE does.
  4. rem
  5. rem 24-06-2002 JvW Initial version, derived from DFSIMAGE
  6. rem 11-07-2002 JvW Updated to use V5 DFSDOS
  7. rem 20-07-2002 JvW Removed confusing 'spacebar' hint for non-registred users
  8. rem 05-11-2002 JvW Updated for executable naming DFSOS2, DFSWIN and DFSDOS
  9. echo.
  10.  
  11. if "%0"=="IPARTEST"     echo on
  12. if "%0"=="ipartest"     echo on
  13.  
  14. if "%OS%"==""        goto notnt
  15. if "%OS%"=="DOS"     goto notnt
  16. if "%OS%"=="MSDOS"   goto notnt
  17. if "%OS%"=="DRDOS"   goto notnt
  18. if "%OS%"=="IBMDOS"  goto notnt
  19. :dfsnt
  20. set dfsexe=dfswin.exe
  21. goto dfsee
  22. :notnt
  23. if "%OS2_SHELL%"=="" goto notos2
  24. :dfsnt
  25. set dfsexe=dfsos2.exe
  26. goto dfsee
  27. :notos2
  28. set dfsexe=dfsdos.exe
  29. :dfsee
  30.  
  31. if "%1" == "?"   goto usage
  32. if "%1" == "/?"  goto usage
  33. if "%1" == "-?"  goto usage
  34. if "%2" == ""    goto usage
  35.  
  36. %dfsexe% -b -q query RValid
  37. if not errorlevel 1 goto work
  38. echo.
  39. echo NOTE: Your DFSee version is not properly registred, this will cause
  40. echo       some extra delays and reminder messages to be displayed  ...
  41. echo.
  42.  
  43. :work
  44. set partid=%2
  45. :auto
  46. set imgcmd=wrim
  47. set imfile=%1
  48. if exist %1      goto checkpart
  49. if exist %1.img  goto checkpart
  50. if exist %1.imz  goto checkpart
  51.  
  52. :trysim
  53. set partid=%1
  54. set imfile=%2
  55. set imgcmd=sim
  56.  
  57. :checkpart
  58. %dfsexe% -b -q query PValid %partid%
  59. if not errorlevel 1 goto validpart
  60. echo.
  61.  
  62. if %imgcmd% == sim goto invalid
  63. goto trysim
  64.  
  65. :invalid
  66. echo The specified parameter "%partid%" is NOT a valid partition id. Use 1 .. nn
  67. goto end
  68.  
  69. :validpart
  70. echo.
  71. if %imgcmd% == wrim goto wrimcmd
  72.  
  73. echo Create an image of partid %partid% to compressed imagefile %imfile%
  74. echo.
  75. %dfsexe% %3 %4 %5 %6 %7 %8 %9 part -q %partid%#sim -zip %imfile%#q
  76. goto end
  77.  
  78. :wrimcmd
  79. echo Restore imagefile %imfile% to partid %partid%
  80. echo.
  81. %dfsexe% %3 %4 %5 %6 %7 %8 %9 part -q %partid%#wrim %imfile%#q
  82. goto end
  83.  
  84. :usage
  85. echo Create a compressed imagefile from a hard-disk partition, or
  86. echo uncompress and write an imagefile back to a partition
  87. echo.
  88. echo Usage:  %0  imagefile  nn  /  nn  imagefile  [ switches ]
  89. echo.
  90. echo         imagefile =  Name of the imagefile, default extention is .IMZ
  91. echo.
  92. echo.                     When only an imagefile is specified (no 2nd param)
  93. echo.                     and the file exists, it will be restored to the
  94. echo                      diskette in the A: drive, otherwise the imagefile
  95. echo                      will be created as an image of the diskette in A:
  96. echo.
  97. echo         nn        =  Partition-id of the partition to use (DFSee PID)
  98. echo.
  99. echo         switches  =  Any valid DFSee switch  (as shown by DFSxx.exe -?)
  100. echo.
  101. echo                      Usefull switches for imaging are:
  102. echo                      -l:logfile  = create a logfile
  103. echo                      -b          = batch option, no confirmations
  104. echo                      -w          = use windowed user interface
  105. echo Examples:
  106. echo  %0 02 os2boot     Create imagefile 'os2boot.imz' from partition 02
  107. echo  %0 02 os2boot     Create 'os2boot.imz' from partition 02, no confirmations
  108. echo  %0 os2boot 02     Restore imagefile 'os2boot.imz' to partition 02
  109. :end
  110.