"VanguardLH" <V@nguard.LH> wrote in message
news:O5KdnRaSP9vc-aLVnZ2dnUVZ_hudnZ2d@comcast.com...
> "Thomas M." wrote in <news:OL8y$eewIHA.4376@TK2MSFTNGP06.phx.gbl>:
>
>> XP SP2
>>
>> I'm trying to create a little batch file that will list all the
>> dependencies
>> for a given service. I found the following command on a Web site:
>>
>> FOR /F "TOKENS=*" %s in ('DependOnService <Service Name>') do @echo
>> %s
>>
>> I have replaced the "<Service Name" wit "Spooler, but the command does
>> not
>> work. Instead, it just tells me that DependOnService could not be found.
>>
>> Can anyone tell me how to get this working in a simple batch file?
>>
>> --Tom
>>
>
> Where are you getting the string (in the parenthesis) that you are
> searching through? Looks to me that you simply have a static string so
> whatever you put there is all that can be parsed by the tokens
> parameter.
>
> Run "sc /?" from a DOS shell. You'll have to redirect the output to a
> file and then read the file to search for the info. Make sure when
> using the 'query' directive that you include the trailing space after
> the equals sign.
First, thanks for the reply. Second, I think that I've solved the problem.
You can read through the background, or skip to the end if you just want to
see the solution that I found.
Background
-------------
I'm glad my post made some degree of sense because I was literally falling
asleep at the keyboard as I was writing it up. Although, I do notice a few
typos. Just to clarify, in the original command I have replaced "<Service
Name>" with "Spooler". I assume that you understood what I intended, but
just wanted to be clear.
I got the command from this site:
http://windowsitpro.com/article/art...-the-print-spooler-service-on-windows-xp.html
The way I read that page it seems like the command is intended to list out
all the services that are dependent on the service named in the command.
But like you, I wondered if the command simply searches the text that is
enclosed in quotes. It seems to me that the command is either not correct,
or that I have really mis-interpreted the information on the page.
Solution
--------
You asked where I got the service name of "Spooler" that I was using in the
command. I have a batch file that will list out all the service names with
the associated display names. I looked at that batch file (I didn't write
it) and found that it uses the sc command, which you also referenced. As
you suggested, I ran cmd and did sc /?, where I found the EnumDepend option.
So, running a command like:
sc enumdepend rpcss (RPCSS is the Remote Procedure Call service)
results in a list of all the services that depend on the RPC service. A
person could then redirect the output into a text file. This is really all
that I was looking for. I must have simply mis-understood the Web page
(link above) from which I got that original command.
Thanks for your help.
--Tom