How to test whether a service is running from the command line

sc query "ServiceName" | find "RUNNING"

Let's go back to the old school of batch programing on windows

net start | find "Service Name"

This will work everywhere...