I\'m trying to do a batch program that needs to check if the service is installed before checking if it is running/stopped.
I would just like to ask if there is any way
According to this answer this is possible in batch using method you described How does one find out if a Windows service is installed using (preferably) only batch?
Alternatively you could query with powershell:
$serv_status = get-service "myService"
if($serv_status -ne $null)
{
// do some operations here
}
sc query myService |find "myService" >nul
will do the trick