84864

How to get an application's process name?

Question:

I am trying to develop a sample application that finds the process name of a particular application.. Suppose there is an application by name <strong>XYZ.exe</strong>.. But when the <strong>XYZ.exe</strong> application is executed, it is not necessary that it holds the same process name.. Let the application run under the process name <strong>abc.exe</strong>..

Now my question is this.. Is it possible to find the process name of <strong>XYZ.exe</strong>?

Any help would much appreciated...

Thanks, Ram

Answer1:

It's simple:

foreach (Process pr in Process.GetProcesses()) { try { Console.WriteLine("App Name: {0}, Process Name: {1}", Path.GetFileName(pr.MainModule.FileName), pr.ProcessName); } catch { } }

Recommend

  • NSMutableArray Access Issue
  • Timing loops with asynchronous functions
  • Using extern @class in order to add a category?
  • Replace and retrieve placeholder value
  • Getting error java.io.FileNotFoundException (log4j log file) at the time of publish project on cloud
  • Thread synchronization with syncwarp
  • In C what exactly happens if i use () to initialize a double dimension array instead of the {}?
  • How can I run DataNucleus Bytecode Enhancer from SBT?
  • Setting the run time properties on SpringApplicationBuilder()
  • Jquery Knockout: ko.computed() vs classic function?
  • aapt.exe'' finished with non-zero exit value 1
  • Reading a file into a multidimensional array
  • Android application: how to use the camera and grab the image bytes?
  • Tamper-proof configuration files in .NET?
  • Code in Job's Script Block after Start-Process Does not Execute
  • Custom Tabgroup Appcelerator
  • How to clear text inside text field when radio button is select
  • Scrapy recursive link crawler
  • Ajax Loaded meta Tags
  • Xamarin Forms - UWP Fonts
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • C# - Serializing and deserializing static member
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Sending data from AppleScript to FileMaker records
  • Running a C# exe file
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • ActionScript 2 vs ActionScript 3 performance
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Arrays break string types in Julia
  • How to include full .NET prerequisite for Wix Burn installer
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is it possible to post an object from jquery to bottle.py?
  • Is there any way to bind data to data.frame by some index?
  • How can i traverse a binary tree from right to left in java?