Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
4,783 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I run in MAUI batch file and i want to uninstall service.
First i want to check if it running if yes to stop it and only after to uninstall it using this code.
How i do it ?
This the code for uninstall
@ECHO OFF
echo stop GS Automation Service
echo ---------------------------------------------------
sc.exe stop "GS Automation Service"
pause
echo Done.
@ECHO OFF
for /F "tokens=3 delims=: " %%H in ('sc query "GS Automation Service" ^| findstr " STATE"') do (
if /I "%%H" EQU "RUNNING" (
echo Stop GS Automation Service......
sc.exe stop "GS Automation Service"
)
)
echo Delete GS Automation Service......
echo ---------------------------------------------------
sc.exe delete "GS Automation Service"
echo ---------------------------------------------------