11-08-2020 08:33 AM - edited 11-08-2020 09:06 AM
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
11-08-2020 10:08 AM
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.
11-08-2020 11:47 PM
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
11-09-2020 02:22 PM
@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.