LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run the Exe from Labview .Net.

I am able to run the Exe from Labview .Net.

 

But i could not able to get the output data from the Exe. for example "use cmd.exe and Ping command"

 

Can u plz tell me ,which  property or invoke method shud i use to get the data.

 

 

 

Thanks,

Venky.

 

0 Kudos
Message 1 of 10
(5,453 Views)
Your question is not clear. What data are you trying to get? What does ping have to do with this?
0 Kudos
Message 2 of 10
(5,434 Views)

Hi Smercurio,

 

The Exe here which iam trying to control from Labview .Net is cmd.exe,Command is either Ping or Ipconfig.

I need to get the output of those command to an indicator. 

We can achieve this easily by using system exec block,but iam trying with labview .Net. Help me,

 

 

 

Thanks,

Venky

0 Kudos
Message 3 of 10
(5,424 Views)
I honestly have no idea what you mean by "LabVIEW .Net". LabVIEW and .NET are 2 different beasts and I don't know what you're trying to do with either.
0 Kudos
Message 4 of 10
(5,386 Views)
Select a System assembly, with a System.Diagnostics constructor, select
"process". Then, use the Start(String Filename) Method. Use StandardOutput
property connected to the start output. From there, you should be able to
flush, and read from it, byte by byte.

Smercurio, he wants to start an exe with .net. And then read back its
output.

Venky, there is no such thing as LabVIEW .NET. You are using .NET in
LabVIEW.

Regards,

Wiebe.


Message 5 of 10
(5,373 Views)

Wiebe,

 

Its working except one exception:

 

 

What is wrong in given code from your point ov view?

 

Andrey.

Message Edited by Andrey Dmitriev on 02-16-2009 06:29 PM
Download All
0 Kudos
Message 6 of 10
(5,364 Views)

Ah, want to launch an executable using .NET from LabVIEW. OK, that makes more sense.

 

Andrey: you need to redirect StandardOutput, as described in the documentation

Message 7 of 10
(5,329 Views)
Yep, that works like a charm. I created the same, only without an example!
It is a nice technique for piping the output, input and error of a command
line executable. I did the same with window API's, and that sure is a lot
more difficult!

What is also nice about this technique, is that you can run the process as
another user. It's a bit more difficult, since the password is a "secure
string", but I will test it on my network, where the window API's failed...

Regards,

Wiebe.


0 Kudos
Message 8 of 10
(5,300 Views)

smercurio_fc is correct, you need to redirect the standard output so that there are synchronous reads from the output, as well as setting the ShellExecute property to false. I would go further to say you might need to set the Arguments and WorkingDirectory through the ProcessStartInfo object as well, depending upon what other commands you might be calling.

 

call_from_net_test.png

0 Kudos
Message 9 of 10
(4,346 Views)

Or you simply use System Exec.vi, most of the time that's sufficient. 🙂

/Y

SystemExec.png

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 10
(4,322 Views)