I need to run a service for some processes, but first I need to verify that the service is installed.
The commands I use to install and uninstall are as follows:
%DIRServico%\SERVICO.EXE /INSTALL
%DIRServico%\SERVICO.EXE /UNINSTALL
If I try to install it already installed, it gives an error and I did not want it to appear, so I wanted the bat file itself to be able to check if the service is installed.
Check if it is running, stopped I already have the commands.
NET START | FINDSTR "Servico"
if %ERRORLEVEL% == 1 goto stopped
if %ERRORLEVEL% == 0 goto started
echo comando desconhecido
goto end
:started
NET STOP Servico
goto end
:stopped
NET START Servico
goto end
:end
If someone has an idea how to solve it, I appreciate it.