home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / doshelp / helpsb.zoo / help / batch / if / device.hlp < prev    next >
Encoding:
Text File  |  1989-01-01  |  896 b   |  23 lines

  1. Testing for DEVICE NAMES
  2.  
  3. As stated in the CONDITION topic, EXIST always succeeds for a file. Some files
  4. that always exist in every directory are the device names, including NUL, AUX, 
  5. and PRN. Files that are device names cannot be deleted or COPYed, so it is
  6. possible for an IF test to determine whether X (which may be an environment 
  7. variable, replaceable parameter, or explicit FOR loop-variable) is a device
  8. name. For example:
  9.  
  10.     IF EXIST X DEL X
  11.     IF EXIST X ECHO X is a device name or a read-only file
  12.  
  13.     DEL FUNNYFIL
  14.     IF EXIST X COPY X FUNNYFIL
  15.     IF EXIST X IF NOT EXIST FUNNYFIL ECHO X is a device name or 0-length file
  16.  
  17.     MD FUNNYDIR
  18.     IF EXIST FUNNYDIR\X ECHO X is a device name
  19.     RD FUNNYDIR
  20.  
  21. Any non-existent file or directory name can be used in place of FUNNYFIL and 
  22. FUNNYDIR, above.
  23.