viewpoint-particle

Author Topic: Finding and killing a process  (Read 242 times)

siocnarf

  • Newbie
  • *
  • Posts: 36
Finding and killing a process
« on: March 29, 2022, 07:42:43 am »
Hi,

How would I test if the process javaw is in memory then killing it?

Thanks,

td

  • Tech Support
  • *****
  • Posts: 4094
    • WinBatch
Re: Finding and killing a process
« Reply #1 on: March 29, 2022, 07:55:45 am »
There are multiple ways. Check out the AppExist function:

https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/WILAK_A__005.htm

Another approach is to use the Process Extender's tListProc function:

https://docs.winbatch.com/mergedProjects/Process/Process/PROCESS_T__002.htm

There are other approaches as well.

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

siocnarf

  • Newbie
  • *
  • Posts: 36
Re: Finding and killing a process
« Reply #2 on: March 29, 2022, 08:10:40 am »
Hi,

And what would be the correct way to kill that process?

Thanks,

td

  • Tech Support
  • *****
  • Posts: 4094
    • WinBatch
Re: Finding and killing a process
« Reply #3 on: March 29, 2022, 08:38:39 am »
If you look in the Consolidated WIL Help file on your computer in the table of contents under "Windows Interface Language Reference -> Functions -> By Type -> Process Control",  you will notice the function "TerminateApp".  Assuming you have the correct process name or window name and your process is a regular Windows application, it should be suggestive...
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

  • Tech Support
  • *****
  • Posts: 4094
    • WinBatch
Re: Finding and killing a process
« Reply #4 on: March 29, 2022, 01:13:00 pm »
Also, if you need to kill the process without using the process name The Process Extender has the "tKillProc" function. There are several other approaches including using WIL CLR hosting capabilities and the "System.Diagnostics.Process" class. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade