Currently I'm using the below function to stop my exe
if the exe is already running
public static bool IsAlreadyRunning()
{
string strLoc = Assembly.GetExecutingAssembly().Location;
FileSystemInfo fileInfo = new FileInfo(strLoc);
string sExeName = fileInfo.Name;
bool bCreatedNew;
Mutex mutex = new Mutex(true, "Global\\" + sExeName, out bCreatedNew);
if (bCreatedNew)
mutex.ReleaseMutex();
return !bCreatedNew;
}
but my exe can run with different arguments, so I need to stop the exe only if there is another instance of my exe running with same arguments.
So is there a way to get the arguments from above code or any pointers to get this done ?