How can I get the path to a Windows service executable WITHOUT using sc qc?
Posted
by
Jared
on Server Fault
See other posts from Server Fault
or by Jared
Published on 2011-11-22T23:03:18Z
Indexed on
2011/11/23
1:59 UTC
Read the original article
Hit count: 413
I need to query a windows service for the path to it's executable via the command prompt. I think the way I would do this is:sc qc myServiceName
, but when I do that, I get the following error:
[SC] QueryServiceConfig FAILED 122:
The data area passed to a system call is too small.
[SC] GetServiceConfig needs 1094 bytes
I think this means that the sc command is sending a data structure to some other library that is too small for the data that needs to be returned. Instead of SC nicely retrying with a larger data structure (1094 bytes) it bombs out and gives me this ugly error message. Thanks Micro$oft.
So is there a way to work around this error? I just need the path to the executable, but will parse it out of some other text if needed.
© Server Fault or respective owner