I have to use sc.exe to log the state of a few services to a text file.
I cannot use an external text, or ini file to list my windows services.
So whilst the following works:
for /f "delims=" %%A in (list.txt) do sc query %%A >> C:\servicestatus.log
I cannot use it, (because it is using an external text file).
So I have to pass all the service names, something like:
FOR /F "tokens=2,3 delims=: " %%A in (SC QUERY "SA1" ^& SC QUERY "SA2" ^& ) do sc query %%A >> C:\servicestatus.log
…but that doesn't output what I require.
Could someone please help me to make the adjustment correctly.