WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mjwillyone on August 20, 2021, 05:09:36 AM

Title: Windows background process shows open software - how to close
Post by: mjwillyone on August 20, 2021, 05:09:36 AM
Hello,

I am having an issue automating a program that, once I export an Excel from it, closes but remains in the background processes listing.   When I have other Winbatch scripts test for its open state to decide it the log-in procedure should be used, Winbatch sees it as open and starts to work.

It doesn't work, obviously, because there are no windows from the software open, etc.

Is there a way to test for the background process and kill it if I KNOW the software has been shut down?  The shut down, by the way, is successful.  It's just for some reason that when I export, this is a problem.  I have tested closing the Excel export file and Excel before I close the other program .. neither fixes the background process issue.

Can anyone help?

Thanks!
Mike
Title: Re: Windows background process shows open software - how to close
Post by: td on August 20, 2021, 07:24:12 AM
Some processes are designed to run detached once the UI is closed and others are just buggy. You may want to research why it is happening before randomly killing the process. Speaking of killing, if you decide to kill the process you already have the answer to your question. Please review the Process class methods for the class used in the example provided to you in your previous topic.

https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.kill?view=netframework-4.8
(https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.kill?view=netframework-4.8)
Title: Re: Windows background process shows open software - how to close
Post by: mjwillyone on August 23, 2021, 08:34:57 AM
Thank you.  I'm not sure why this program only continues running the process after a file is exported.  I was able to kill the program and make this work!