03-19-2012 11:22 AM
Hi all,
To start off, I'm using LabVIEW 2011 on a Windows 7 machine. I've been mounting flash drives to a work computer, so that I can plug in more than 26 flash drives at a time, and now I've been asked to create a LabVIEW program that can mount the flash drives easily so that anyone can do it.
When I mount a flash drive, I use the Disk Management utility found in the computer managment utility. I did, however, figure out how to mount the flash drives using the command prompt utility, using a command called diskpart. My problem is, if you open a command prompt and type in diskpart, it opens a new command prompt window. I thought that I would be able to use the system exec.vi to enter in multiple commands to the same command prompt window, and recieve the output from the commands, but since diskpart opens it's own window, I cannot do this. Does anyone have an idea? Thanks!
03-19-2012 01:01 PM
Why wouldn't the flash drives be mounted automatically by Windows? Did you do something to prevent this?
When you enter "diskpart" in a command window it does not open a new command window. It runs diskpart within that same command window, changing the prompt. You can create a script to control diskpart. Documentation for this is available on the Microsoft web site.
03-19-2012 01:41 PM
I'm manually mounting my flash drives to folders, then I'm removing their drive letter, so that I can have more than 26 drives plugged into the computer which is responcible for removing the necessary information from them. I don't know how you made diskpart operate from the original command prompt, if I use either system exec.vi in labview, or the command prompt, and type in disk prompt, a new window opens. Lastly, if I did open up diskpart in the original command prompt window, I need to figure out how to enter in a command to a command prompt, receive the output from the command prompt, and then enter in another command to the original command prompt. For instance, I need to be able to run the the following two commands:
DISKPART> select volume 3
DISKPART> assign mount=C:\drive27
(note, DISKPART> is not part of the command, but rather, when you use diskpart, a new window opens and this is the marker for where to enter text)
03-20-2012 08:53 AM
System Exec is the equivalent of using Start -> Run. It's not the same as entering commands in a command window. That's what most people get confused about. Thus, if you enter "diskpart" in the Start -> Run window, then you will get a new command window open. This is by design of the OS.
As for getting text in/out of this window, I posted an example on how to do this in an older thread: http://forums.ni.com/t5/LabVIEW/URGENT-How-we-read-stdout-directly/td-p/801983