LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Pendrive safety extract

Hi
I need a .vi or any example with explain ,about, how can I extract a USB drive with safety mode.
Thanks

0 Kudos
Message 1 of 2
(2,426 Views)

Hi Luis0107

I´ve been investigating about how to eject a USB drive using LabVIEW and what I found is that this is possible using the command prompt and a utility which can be downloaded from the following link: http://www.uwe-sieber.de/drivetools_e.html This utility allows you to safely eject drives from the command prompt. You need to download the RemoveDrive.zip and extract the zip file in a known location (ex the path to your VI). The folder contains the user manual for the utility and two other folders, if you have a 32-bit system, you will need to use the Win32 folder, if you have a 64-bit system, you can use either one. Make note of the location of said folder (ex C:\Users\fbecerra\Downloads\removedrive\Win32).

Once you have downloaded these files, we can use LabVIEW to eject the drive. We can use the SystemExec.vi to launch a command to command prompt. This VI is located on the functions palette in Connectivity > Libraries & Executables. Create a string constant in the Command Line input terminal by right-clicking and selecting Create > Constant and copy the path mentioned in the paragraph above, followed by \removedrive and the letter of the drive you wish to safely eject (ex C:\Users\fbecerra\Downloads\removedrive\Win32\remove drive 😧 ). This will automatically open the command prompt, execute the command and close automatically. The SystemExec.vi has output terminals which provide us feedback on the command executed, for example, the Standard Output output terminal will throw us the result of the operation such as the success status.

I hope this covers your need. Have a great day!

 


Fernando Becerra | Field Applications Engineer | National Instruments | CLA | CTD
0 Kudos
Message 2 of 2
(2,357 Views)