From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get specific cmd.exe reference after it is launched

Solved!
Go to solution

I have a thread pool that has 'n' workers. Each of these workers, when idle and data is available, calls a perl script using the system exec VI. Is there any way I can get a reference to the particular cmd.exe window it launches? I don't want to arbitrarily get a reference to a window based on cmd.exe name, because there could be 'n' number of them open at any given time.

0 Kudos
Message 1 of 4
(3,329 Views)
Solution
Accepted by topic author GregFreeman

Have you tried running a cmd from .NET?  I think this is possible using System.Diagnostics.Process although I haven't tried it before.

http://stackoverflow.com/questions/691716/running-cmd-commands-via-net

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 2 of 4
(3,291 Views)

I agree with Putnam that .NET may be the best way to go.

I'd been thinking about replacing my use of the System Exec.vi with .NET and your post gave me the incentive to steal a little code from another thread and make my VI.  This VI has the handles and title exposed; although unnecessary for my needs.  Hope this helps jump start your effort.

 

James

Tech Advisor - Automation
LabVIEW 5.0 - 2020
Message 3 of 4
(3,268 Views)

Thanks, this is what I ended up doing. I was considering going that route and it seemed that creating the process was slow, but that was only on the first call. All subsequent calls were near the same speed as the system exec VI, even when I created a new process and closed that process with every call, keeping it relatively stateless on my app layer. I didn't want to manage keeping references open for the lifetime of my application and managing the cases where one may go invalid for whatever reason etc. 

 

Message 4 of 4
(3,215 Views)