Save the below lines of code in a .bat file. I am trying to start MySQL57 service if its not running already.
for /F "tokens=3 delims=: " %%H in ('sc query MySQL57 ^| findstr " STATE"') do (
if /I "%%H" NEQ "RUNNING" (
net start MySQL57
)
)