LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send a command to an already open command window?

With the System Exec.vi I can open up a command window and keep the window open using the /k command.  How though can I return to that open command window and execute another command?  If I run System Exec.vi again it will just open up a new command window which I don't want.

 

I appreciate any help on this.

 

Thanks

 

Loren

0 Kudos
Message 1 of 13
(11,685 Views)

Unfortunately, you are limited to the functionality you are experiencing.

CLD | CTD
LabVIEW 2011 SP1 | TestStand 4.5
0 Kudos
Message 2 of 13
(11,678 Views)

You can try using OpenG Pipe library. It works similar to System Exec, but communication with the standard IO of the application happens over pipes. This allows to send commands to the console application and receive answeres from it at runtime.

Rolf Kalbermatter
My Blog
Message 3 of 13
(11,659 Views)

Thanks Rolf.  I'll have a look at that.

 

Loren

0 Kudos
Message 4 of 13
(11,645 Views)

You can also try the copy/paste method I showed here: Re: URGENT!!! How we read stdout directly? - LabVIEW - NI Discussion Forums

0 Kudos
Message 5 of 13
(11,616 Views)

Rolf,

 

Would you be able to send me a quick example VI showing how I would use the OpenG pipes to open up a command window run a "dir" command to get the directory list and read that back into LabVIEW?  I certainly appreciate your help on this.

 

Loren

0 Kudos
Message 6 of 13
(11,603 Views)

One of the marked solutions is here.

You would need to use WIN APIs.

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 7 of 13
(11,578 Views)

@lmcclennan wrote:

Rolf,

 

Would you be able to send me a quick example VI showing how I would use the OpenG pipes to open up a command window run a "dir" command to get the directory list and read that back into LabVIEW?  I certainly appreciate your help on this.

 

Loren


This is one way to do what you describe. You can disregard the standard error output (and set the according boolean to false to not create the according pipe) if you know  that the command should work.

Rolf Kalbermatter
My Blog
Message 8 of 13
(11,579 Views)

Rolf,

 

That VI was extremely helpful.  Thanks for your support.

 

Loren

0 Kudos
Message 9 of 13
(11,548 Views)

Hello,

I'm trying to implement the OpenG pipes library on windows 7 64bit with labview 2012.

When I execute the example code that Rolf posted. (System Command (cmd.exe) test.vi) I get the following error:

 

The process tried to write to a nonexistent pipe.

 

Any tips on what I can do?

0 Kudos
Message 10 of 13
(11,305 Views)