home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / cdd.cmd < prev    next >
OS/2 REXX Batch file  |  1997-07-06  |  817b  |  39 lines

  1. /* CDD.CMD -- Emulates the 4DOS/4OS2 command to change drive and 
  2. directory
  3.  
  4. D.F. Yriart -- 7 Aug 1996 */
  5.  
  6. rcode = 0           /* "Good" return code */
  7. nullString = ''
  8. PARSE ARG newDir
  9. currentDir = Directory()
  10.  
  11. if newDir = '/?' then SIGNAL usage
  12.  
  13. if newDir = nullString then
  14.   SAY currentDir
  15. else
  16.   DO
  17.      /* SAY 'Changing to' newDir 'from' currentDir */
  18.  
  19.      success = Directory(newDir)
  20.  
  21.      if success = nullString then
  22.        DO
  23.           SAY newDir 'does not exist'
  24.           rcode = 1    /* set rc = 1 because command failed */
  25.        END
  26.   END
  27.  
  28. EXIT rcode
  29.  
  30. usage:
  31. SAY "Use the CDD command to change the current drive and directory."
  32. SAY "Syntax:"
  33. SAY "  CDD [drive:][path]"
  34. SAY
  35. SAY "CDD works like the CD command, except that it will also change"
  36. SAY "drives."
  37.  
  38. EXIT 3
  39.