NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Executable for tasklist

I am trying to programmatically check to see if a program is running and then save that result to a file to do some post processing on. I can get this to work via the command line (cmd.exe). If I issue the command tasklist | Find "svchost.exe" > fg.txt it checks to see if that process is running and places the results into a fg.txt file. I try to use this concept thru the call executable in test stand and although it seems to run nothing gets written to the file. Here is a snippet of that code any help would be appreciated.   

mark03053_0-1719872875955.png

 

0 Kudos
Message 1 of 6
(256 Views)

the file pathname is correct in the above snippet. It should be going to cmd.exe it was appended accidentally when I was doing the snippet.  

0 Kudos
Message 2 of 6
(255 Views)

So the issue is with the argument expression but not sure the issue.. 

0 Kudos
Message 3 of 6
(227 Views)

How about using the .net version?

Oli_Wachno_0-1719899519183.png

 

0 Kudos
Message 4 of 6
(219 Views)

Thanks for your help. I tried what you suggested and it works great. Is there a .net call where I can also start a program that is on the hard drive if I give it the path of the program that I want to open? I would like to do everything in .net if possible.

0 Kudos
Message 5 of 6
(207 Views)

You may wanna look into

https://learn.microsoft.com/de-de/dotnet/api/system.diagnostics.process.start?view=netframework-4.8

and

https://learn.microsoft.com/de-de/dotnet/api/system.diagnostics.processstartinfo?view=netframework-4...

 

in case you are usually doing LabVIEW programming, you might find the following thread helpful picture-wise

0 Kudos
Message 6 of 6
(198 Views)