LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep batch file running in background - force close at end

I currently have a VI that runs a start up procedure in which a batch file is run. This is to be kept open while the rest of the program is running. I can currently do this but I want the batch file to be closed during the shutdown mechanism of the code.

 

Anybody have experience with something similar? If I directly run the batch files, I can use the x to close it. Is there something similar in LabVIEW?

 

Thanks,

 

Scot07

Download All
0 Kudos
Message 1 of 4
(2,853 Views)

I think you need to kill the task from the command line.  It's inelegant, and it's not easy to kill the right one if there are more than one instance of cmd.exe open.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 4
(2,827 Views)

Hi Scot07,

Do you mean any exe (which got launched using a batch file) needs to killed as part of shutdown mechanism of the code? If yes ,then i can suggest two ways to kill any process/exe

  • using task kill command "taskkill /F /IM <exe name> /T"
  • using .net constructor node and calling process constructor

     

     

     

Regards,
Srikrishna


0 Kudos
Message 3 of 4
(2,785 Views)

@srikrishnaNF wrote:

Hi Scot07,

Do you mean any exe (which got launched using a batch file) needs to killed as part of shutdown mechanism of the code? If yes ,then i can suggest two ways to kill any process/exe

  • using task kill command "taskkill /F /IM <exe name> /T"
  • using .net constructor node and calling process constructor

     

     

     


Taskkill is the one I was thinking about.  If you launch the system exec as "fire and forget", you have to kill the task manually if the code doesn't include some kind of terminate command.  I'm sure the .NET one works as well.

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 4
(2,761 Views)