Do you need to see if a process is already running? It’s pretty easy with the code below. I wrote this code for my console apps .NET back utility and .NET file cleaner utility.
''' <summary>
''' Check to see if the current app is already running.
''' </summary>
''' <returns><c>true</c> if app is not running, <c>false</c>.</returns>
Public Function IsProcessRunning() As Boolean
Return If(Process.GetProcessesByName(
Path.GetFileNameWithoutExtension(
Assembly.GetEntryAssembly().Location)).Count() > 1,
True, False)
End Function
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.
