Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the location of exe that runs as a windows service in run-time?

How can I find the location of exe that runs as a windows service in run-time?

like image 243
mrtaikandi Avatar asked Jan 21 '26 01:01

mrtaikandi


2 Answers

Use a registry look-up:

e.g.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\' + ServiceDisplayName;

then read ImagePath value.

like image 185
tomsee Avatar answered Jan 23 '26 21:01

tomsee


Programmatically or with a tool?

In the latter case, I recommend using Sysinternals' Process Explorer: it shows all running processes, including services, and one of the fields is the command line used to run the process, including full path.

Their command line utility, PsService, can be useful too.

like image 43
PhiLho Avatar answered Jan 23 '26 20:01

PhiLho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!