Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looking for a reliable way to determine if a drive letter is in use
#13
mnrvovrfc,

Using a command such as "vol F:" didn't quite work out for me.

But I have a solution that is working for me now. I started with a little proof of concept test and when that worked I put it in my 16,000+ line QB64PE code where it seems to be working flawlessly now.

What I discovered was that in each of these scenarios where a removable drive like a USB Flash Drive (UFD) still shows up in File Explorer with a drive letter but there are no actual partitions on the device, diskpart will list that volume as being 'Unusable". So, I simply have my code do this:

1) Generate a list of all volumes.
2) For any volume that is both removable type media AND having a status of "Unusable", I select that volume in Diskpart and issue a "remove letter=x" where x is the letter still showing up in File Explorer.

That frees up that drive letter and allows drive letter detection to then no longer stumble over these odd UFDs.

This is a program I've been working on and expanding / refining for several years now and all that time I have had these odd little corner cases with drive letter detection. I finally took about a day and half to do some intensive troubleshooting of the issue and it looks to me like I finally have this resolved.

Thanks to all for the suggestions and ideas.
Reply


Messages In This Thread
RE: Looking for a reliable way to determine if a drive letter is in use - by hanness - 05-09-2023, 04:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What the heck, it's Friday let's drive some people nuts. doppler 4 1,051 10-21-2024, 11:31 AM
Last Post: SpriggsySpriggs
  _File$ is not behaving as expected, cannot determine why hanness 6 1,697 10-14-2024, 01:56 AM
Last Post: a740g
Sad Is there a way to determine screen resolution ? doppler 2 750 08-03-2023, 02:30 PM
Last Post: doppler
  Is it possible to determine the screen scaling factor within QB64? hanness 3 864 05-09-2022, 01:37 AM
Last Post: hanness

Forum Jump:


Users browsing this thread: 1 Guest(s)