DriveName$
Name$ = DriveName$()
 
Parameters: NONE
Returns:

    Name$ = The volume name of the current device
 

      The DriveName$ function the volume name of selected drive letter.



FACTS:


      * Always check if a drive (device) is ready before attempting to query information about it, such as it's volume name, serial, and even when dealing files or folders. The reason for this, is that the user running your program may be directing your program to read/write information to a drive(device) that has no media in it. Like floppy , CD, or DVD drives





Mini Tutorial:


      This example reads the current drive list than displays the volume name, serial and ready status of each one.


  
; Read the Drive List in the string Drives$
  Drives$=DriveList$()
  
; display the drive list
  Print "Drive Letters In This Machine:"+Drives$
  
; loop through the drive list string
  For lp=1 To Len(drives$) Step 2
     
   ; Print a blant line to space the output out
     Print ""
     
   ; Grab the Drive Letter from the drive string
     DriveLetter$=Mid$(Drives$,lp,2)
     
   ; Display the stats about this drive.
     Print "Checking Drive:"+DriveLetter$
     Print "Drive Name:"+DriveName$(DriveLetter$)
     Print "Drive Ready:"+Str$(DriveReady(DriveLetter$))
     Print "Drive Serial:"+Str$(DriveSerial(DriveLetter$))
  Next lp
  
; Display the screen and wait for a key press
  Sync
  WaitKey
  



This example will return something like the following. It's output will differ on each computer, as each computer have a different collection of drives installed in it.

  
Drive Letters In This Machine:A:C:
  
Checking Drive:A:
Drive Name:
  Drive Ready:0
  Drive Serial:0
  
Checking Drive:C:
  Drive Name: Windows
  Drive Ready: 1
  Drive Serial: 131231234
  

 
Related Info: DriveExist | DriveList$ | DriveReady | DriveSerial :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com