Closing a running application on PC

After I launch a exe app using lauch();
how do i close it??
Please help

I don’t believe that you can close it from Processing.

This function (roughly) emulates what happens when you double-click an application or document in the macOS Finder, the Windows Explorer, or your favorite Linux file manager. If you’re trying to run command line functions directly, use the exec() function instead (see below).

This function behaves differently on each platform. On Windows, the parameters are sent to the Windows shell via “cmd /c”.

I believe that there isn’t a special connection between Processing and something that you launched. It sends a request to the operating system to launch the program, and it doesn’t know what happens after that.

Are you trying to launch an application that you wrote, or a standard desktop application? If it is an application that you wrote then you could have it listen for a signal using one of the networking and communcation protocols (see Processing libraries) and shut down if it receives it – for example, using OSC.

If you provide more details about what you are trying to do you will probably get better advice.

That or if libraries are too dificult for you, if the program is meant to run on one device, you can just make a text file with “open”/“close”, “0”/“1” or something like that, that the second app can read.

In my experience with C#, once the launching program is closed, the program launched is closed as well. This is because the program was launched via a terminal/command line in the background. You can try using the terminal to open and close the program. Though I’m not sure, how to do that.