LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the mounted drives with full names?

Solved!
Go to solution

How do I get the names besides C:, D:, ? In my application, I plug in a USB drive, a new drive will be mounted. I tried getLatestDrive.vi in Labview but had problems on some PCs. When my DUT is a virgin board, Labview finds the latest drive correctly. But when the DUT is a non-virgin board, Labview finds a local hard disk E:\ drive which is wrong. Again, the problem was found only on some of the PCs not all the PCs we've tested on. Since the DUT's drive name (besides the letter E: or I:, etc.) is known to me. So I want to find a function which lists the full names of the drives to locate my DUT drive without mistakes.

 

Thanks very much!

Spring

0 Kudos
Message 1 of 6
(4,194 Views)

I'd suggest this function to get drive name.

 

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364996(v=vs.85).aspx

 

Also using the command line you can get it with something like this.

 

wmic logicaldisk get volumename

0 Kudos
Message 2 of 6
(4,167 Views)

Hello Hooovahh,

 

Thanks very much! I tried wmic logicaldisk get volumename with the systemexec.vi and it returned the volume name I was looking for. Now, how do I get the disk info as well (such as E:\ or I:\, etc.)? That command line only returned the volume name.

 

Best regards,

spring

0 Kudos
Message 3 of 6
(4,143 Views)
Solution
Accepted by topic author 2014spring

wmic logicaldisk get name

 

You can read up on the help wmic is pretty useful, try

 

wmic logicaldisk get /?

 

or

 

wmic logicaldisk /?

 

or

 

wmic /?

Message 4 of 6
(4,116 Views)

Thanks Hooovahh!

 

I've already found a solution:

http://forums.ni.com/t5/LabVIEW/Listing-mounted-drives/m-p/3179913#M919779

 

Best regards,

Spring

0 Kudos
Message 5 of 6
(4,058 Views)

Hello Hooovahh,

 

I found that ListFolder.vi only worked on some of the machines. On the other PCs where my application was deployed, it didn't work. So I replaced that Labview vi with a system Exc.vi calling for this DOS command "Cmd /C wmic logicaldisk get DeviceID" and came up with a solution! It worked on the machines where ListFolder.vi didn't work! So, I wanted to thank you very much for your valuable advices on this wmic thing! 🙂

 

Best regards,

Spring

0 Kudos
Message 6 of 6
(3,954 Views)