LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running multiple commands from labview in comandline

Hello, 

i want to run a programm on labview, that communicates with the comandline. First of all it should open Powershell which is possible by using a System Exec vi and the cmd /c command.

After that i want to run another command in the same comandline which is connected to the powershell. How do i combine these two commands?

 

Another solution would be connecting to the powershell directly instead of opening the comandline at all, so i can input the command directly to the powershell.

 

A third solution would be, to combine those two commands (hoping into the powershell and coding without pressing enter).

 

I do not know how to implement this in labview.

0 Kudos
Message 1 of 5
(1,652 Views)

@ranzinger wrote:

Hello, 

i want to run a programm on labview, that communicates with the comandline. First of all it should open Powershell which is possible by using a System Exec vi and the cmd /c command.

After that i want to run another command in the same comandline which is connected to the powershell. How do i combine these two commands?


There's this : Execute Multiple Commands With One System Exec Call in LabVIEW - NI

 

But you might need to use a pipe. That's where it get's complicated...

 


@ranzinger wrote:

Another solution would be connecting to the powershell directly instead of opening the comandline at all, so i can input the command directly to the powershell.


How about using .NET:

 

System.Management.Automation.PowerShell.Create();

@ranzinger wrote:

A third solution would be, to combine those two commands (hoping into the powershell and coding without pressing enter).


That usually complicates things...

0 Kudos
Message 2 of 5
(1,638 Views)

Hi ranzinger,

 

the 4th option would be to create a batch file (with all needed commands) and just execute that…

Best regards,
GerdW


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

Thanks for the answer, what do you mean with using the.Net function?

0 Kudos
Message 4 of 5
(1,623 Views)

@ranzinger wrote:

Thanks for the answer, what do you mean with using the.Net function?


System.Management.Automation.PowerShell.Create();

Or in LabVIEW:

PowerShell dotNET.png

0 Kudos
Message 5 of 5
(1,605 Views)