Completely uninstall Windows Service

Source: Internet
Author: User

Preface, I used quartz.net + quartz.config + quartz_jobs.xml to write a Windows service that uses the following bat script to perform a service installation, start, pause, uninstall

@echo off:菜单clsecho ============================================echo                  BI数据抓取服务菜单echo 1.安装     2.启动  3.停止        4.卸载set /p 选择=请进入命令:if %选择%==1 goto 安装if %选择%==2 goto 启动if %选择%==3 goto 停止if %选择%==4 goto 卸载:安装echo 正在安装BI数据抓取服务...sc create BICrawlService start= auto binPath= E:\XX\XXX\BIJobSchedule\BIJobSchedule\bin\Debug\BIJobSchedule.exe DisplayName= BI数据抓取服务pausegoto 菜单:启动echo 正在启动BI数据抓取服务...net start BICrawlServicepausegoto 菜单:停止echo 正在停止BI数据抓取服务...net stop BICrawlServicepausegoto 菜单:卸载echo 正在卸载BI数据抓取服务...sc delete BICrawlServicepausegoto 菜单

installation, startup, both successful, and the service is working, but when I choose to uninstall the service directly, I find that the service is still in the list of services, and the monitoring shows that the service is still working, which leads to a thorough uninstall method of Windows service

1. 根据网上资料,显示如下命令可直接卸载服务

Sc Delete [service_name]//Obviously, the service is deleted, but the list is still displayed properly, and any action on the service will appear with an error code such as 1062,1072
2. Delete the registry contents
CMD under regedit;
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services Find the name of your service, and then delete the entire folder,
But I didn't find the corresponding folder here.
3. Find PID, Force kill process according to PID
3.1. Turn off the mmc.exe:

taskkill /F /IM mmc.exe

3.2. Find the PID of the service:

3.3. Execute the KILL command:

taskkill /PID 1104 /f

As above, the Windows service on my computer is completely clean.

Reference:
Http://www.cnblogs.com/Wolfmanlq/p/5872043.html
https://stackoverflow.com/questions/305037/sc-deleteservice-failed-1072#305075

Completely uninstall Windows Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.