Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for bootdriv.rex

(view source code of bootdriv.rex as plain text)

  1. /* Check for boot drive                                                   */
  2. /* Techniques explained by Dick Goran in his January 1997 Rexx Column in  */
  3. /* OS/2 Magazine, found at http://www.toward.com/cfsrexx/os2-mag/9701.htm */
  4.  
  5. /* Display blank line */
  6. Say
  7.  
  8. /* Check command line parameters (none required) */
  9. Parse Arg params
  10. If params <> "" Then Call Syntax
  11.  
  12. /* What OS? */
  13. Parse Source os .
  14. If os = "OS/2" Then Do
  15. 	/* RLANUTIL.DLL, containg GetBootDrive, was added in Warp Connect */
  16. 	Call RxFuncAdd "GetBootDrive", "RLANUTIL", "GetBootDrive"
  17. 	If RxFuncQuery( "GetBootDrive" ) = 0 then do
  18. 		bootdrive = GetBootDrive()
  19. 	End
  20. 	Else Do
  21. 		/* This should work in any pre Warp OS/2 version too */
  22. 		path = Value( "PATH", , "OS2ENVIRONMENT" )
  23. 		Parse Upper Value path With ":\OS2\SYSTEM" -1 bootdrive +2
  24. 	End
  25. End
  26. Else Do
  27. 	/* Initialize RexxUtil library */
  28. 	If RxFuncAdd( "sysloadfuncs", "RexxUtil", "sysloadfuncs" ) = 0 Then Do
  29. 		Call sysloadfuncs
  30. 	End
  31. 	Else Do
  32. 		Call Syntax "Error initializing RexxUtil"
  33. 	End
  34. 	bootdrive = SysBootDrive( )
  35. End
  36.  
  37. Say "Boot drive = "||bootdrive
  38.  
  39. Exit 0
  40.  
  41.  
  42. Syntax: Procedure
  43. 	Parse Arg errmsg
  44. 	If errmsg <> "" Then Say errmsg||"0D0A0D0A"X
  45. 	Say "BootDriv.rex,  Version 2.01 for OS/2 and Windows"
  46. 	Say "Return drive letter from which computer was booted"
  47. 	Say
  48. 	Say "Techniques for OS/2 explained by Dick Goran in his"
  49. 	Say "January 1997 Rexx Column in OS/2 Magazine, found at"
  50. 	Say "http://www.toward.com/cfsrexx/os2-mag/9701.htm"
  51. 	Say
  52. 	Say "Usage:  BOOTDRIV.REX"
  53. 	Say
  54. 	Say "Written by Rob van der Woude"
  55. 	Say "http://www.robvanderwoude.com"
  56. 	Exit 1
  57. Return
  58.  

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