How can I remove/delete an executable (".exe") file once it ceases running or being utilized
in another process?
6 Replies
What exactly do you wanna delete?
You cannot delete a process of another process, since it's a process itself.
This sounds nefarious
@leave what for?
Just show a prompt "valorant-account-stealer.exe finished it's work, you can delete it now"
I don't necessarily need to delete, but simply to know how we can implement that in C#. To know when a process is running (thus, when it stops running), or not running at all.
Either through the build in
Process
class in System.Diagnostics
-> https://learn.microsoft.com/de-de/dotnet/api/system.diagnostics.process?view=net-8.0
-> with the static Method GetProcessesByName(processName)
or through WMI through PInvoke or better the ManagementObjectSearcher
where you can write a SQL query -> SELECT * FROM Win32_Process WHERE Name LIKE 'valorent-account-stealer%';