zip2exe.cmd 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**** REXX ******** ZIP2EXE.CMD ************** 01/04/96 *********\
  2. |** This exec will prepend the Info Zip unzipsfx.exe file to an **|
  3. |** existing ZIP file to create a self extracting zip. **|
  4. |** **|
  5. |** The exec requires 1 argument, the name of the zip file to be **|
  6. |** acted upon. **|
  7. |** **|
  8. |** Put this exec into the path that contains your Info Zip **|
  9. |** executables. **|
  10. |** **|
  11. \*********************************************************************/
  12. rc = 0
  13. /** Start Argument processing ** End Initialization **/
  14. PARSE UPPER ARG zip_file
  15. IF zip_file = ""
  16. THEN
  17. DO
  18. SAY "You must specify the name of the file to be processed"
  19. SAY "Please try again"
  20. rc = 9
  21. SIGNAL FINI
  22. END
  23. IF POS(".ZIP",zip_file) = 0
  24. THEN
  25. DO
  26. sfx_file = zip_file||".EXE"
  27. zip_file = zip_file||".ZIP"
  28. END
  29. ELSE
  30. sfx_file = SUBSTR(zip_file,1,LASTPOS(".",zip_file))||"EXE"
  31. zip_file = STREAM(zip_file,"C","QUERY EXISTS")
  32. IF zip_file = ""
  33. THEN
  34. DO
  35. SAY "The file "||ARG(1)||" Does not exist"
  36. SAY "Processing terminated"
  37. rc = 9
  38. SIGNAL FINI
  39. END
  40. /** Start unzipsfx location ** End Argument processing **/
  41. PARSE UPPER SOURCE . . command_file
  42. unzipsfx = SUBSTR(command_file,1,LASTPOS("\",command_file))||,
  43. "UNZIPSFX.EXE"
  44. IF STREAM(unzipsfx,"C","QUERY EXISTS") = ""
  45. THEN
  46. DO
  47. SAY "We are unable to locate the UNZIPSFX.EXE source"
  48. SAY "Ensure that the ZIP2EXE command is in the directory",
  49. "which contains UNZIPSFX.EXE"
  50. rc = 9
  51. SIGNAL FINI
  52. END
  53. /** Execute the command ** End Argument processing **/
  54. ADDRESS CMD "@COPY /b "||unzipsfx||"+"||zip_file,
  55. sfx_file||" > NUL"
  56. IF rc = 0
  57. THEN
  58. SAY sfx_file||" successfully created"
  59. ELSE
  60. SAY sfx_file||" creation failed"
  61. FINI:
  62. EXIT rc