Forum Discussion

lphilippe_macau's avatar
lphilippe_macau
Contributor
13 years ago

Get the name of a DVD/CD

Hi, I don't know if anyone can help but here goes: 



I am trying to got the name of a DVD once it's entered into a drive (ex: D:\). I currently can get the drive info with the aqfilesystem.getdriveinfo("D:\\") method but this does not give me the name of the DVD itself, I can get a lot of other info but that is not what I'm looking for. 



Do any of you know how I can get this information? 



Thank's a lot!

3 Replies



  • Well I found a workaournd for this and thought I would post it so if anyone needs it they can use it. 




    1. First I added a tested app in TC, which is a batch file that I wrote. 

    2. The batch file contains the following: 


    diskpart /s %1 > %2

    This Batch file takes the 2 parameters %1 and %2 which are respectively the path to a script sent do "diskpart" and the path to the output logfile

         3. Next I created a script.txt passed to diskpart which contains the following: 



    list volume

    The essentially lists all the volumes of the filesystem.  This list is outputed to the log file specified earlier.

         4. Then I use the "aqfile.readwholefile" in TC to load the file into a variable and then use the "find" method to make sure my DVD's name is in this  string. 



    All in all it's a pretty complicated work around, but it works and like a charm. Hopefully one day TC will implement a feature to get a volume name. 

    If you have questions, just reply and I'll be back to answer as soon as I can. 





    P.S. Sorry for the lousy formatting. 
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Louis-Philippe,



    Do you mean the drive label? You can use the Scripting.FileSystemObject scripting object to get this info:

    Sys.OleObject("Scripting.FileSystemObject").Drives("D:").VolumeName
  • Wow, that's so much more simple.... I was kind of proud of my work around but there's no sense in using it now :)  Thank's Helen!!