REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Get the current boot drive





 
/* get the OS/2 boot drive                                          */
/*                                                                  */
/* Note that there are functions to get the boot drive in many      */
/* REXX DLLs available, for example in the RXLANUTIL DLL or in the  */
/* new REXXUTIL DLL. introduced with Object-Oriented REXX           */
/*                                                                  */
GetBootDrive:
                                /* load REXXUTIL                    */
  call rxFuncAdd "SysLoadFuncs", "REXXUTIL", "SysLoadFuncs"
  call SysLoadFuncs

  irc = SysIni( "BOTH","FolderWorkareaRunningObjects","ALL:","Objects" );
  BootDrive = left( Objects.1,2 );
  say "Boot drive " BootDrive
return



Source:  Launching Objects on the OS/2 Desktop 
 
 If you can't use the DLL REXXUTIL, you can use the function <FILESPEC on 
 the environment variable COMSPEC or RUNWORKPLACE to get the boot drive. 
 Or, use the contents of the PATH variable: 

  
 /*                                                                    */
 /* Source: Dick Goran                                                 */
 /*                                                                    */
   parse upper value VALUE( "PATH",, "OS2ENVIRONMENT" ) with "\OS2\SYSTEM" -2,
                     GBL.boot_drive                                        +2
 
 
 Note that neither of this methods is save. So you should add some further 
 tests (e.g. Does CONFIG.SYS exist in the root directory?) if using it! 
   

Inf-HTML End Run - Successful