LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing parameters to an exe file using labview

hello, i have an .exe file which i run by writing paraemeters in cmd, now i want to build a vi that allows me to write the parameters (which are strings, numeric and an enum) into the exe file and reads the output. How can i do that?

0 Kudos
Message 1 of 6
(1,582 Views)

Hi corrado,

 


@domcorrado wrote:

hello, i have an .exe file which i run by writing paraemeters in cmd, now i want to build a vi that allows me to write the parameters (which are strings, numeric and an enum) into the exe file and reads the output.


Use the SysExec function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,556 Views)

@domcorrado wrote:

hello, i have an .exe file which i run by writing paraemeters in cmd, now i want to build a vi that allows me to write the parameters (which are strings, numeric and an enum) into the exe file and reads the output. How can i do that?


Well you basically build your command line string and use the System Exec vi to launch it

 

Here's picture of a program that builds a command line for Iperf, also pipes Iperf output to the program mtee if desired

 

Then I save the command line to Temp.bat and use the System Exec to run the batch file.

 

GperfCapture.PNG

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 6
(1,517 Views)

Hello, im using the system exec block to write a cmd line to an .exe but it wont work.

Im specifying the path of the exe file in the command line )using cmd /c C:\ etc.) input and writing my line in the standard output input, but every time i try to run the program it gives me a standard error saying

 

[11904] Failed to execute script 'prova' due to unhandled exception!
Traceback (most recent call last):
File "prova.py", line 239, in <module>
AttributeError: 'NoneType' object has no attribute 'count'

 

anyone can help me understand whats wrong?

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

Hi corrado,

 


@domcorrado wrote:

Hello, im using the system exec block to write a cmd line to an .exe but it wont work.

Im specifying the path of the exe file in the command line )using cmd /c C:\ etc.) input and writing my line in the standard output input, but every time i try to run the program it gives me a standard error saying

 

[11904] Failed to execute script 'prova' due to unhandled exception!
Traceback (most recent call last):
File "prova.py", line 239, in <module>
AttributeError: 'NoneType' object has no attribute 'count'

 

anyone can help me understand whats wrong?


"*.py" typically is not an executable…

 

Mind to share a minimal example code to demonstrate what you are doing?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(1,487 Views)

The Python script is most likely not the one to execute. The executable is supposed to run the script.

 

@domcorrado: The executable is putting out that error. It has nothing to do with LV, as it seems. Regarding your inital question: executing the software is easy, but reading console output isn't. You could redirect outputs in the console to a file and read that into LV.  https://www.windowscentral.com/how-save-command-output-file-using-command-prompt-or-powershell

0 Kudos
Message 6 of 6
(1,481 Views)