Registering a Windows application as a Windows service

Source: Internet
Author: User

@echo off

:: Set Service Name
Set Service_name=servicemanagement

:: Set Service description
Set service_description= file Security upload Service

:: Set the service program path
Set Prog_path=%cd:\=\\%\\servicemanagement.exe

:: Set startup mode for service Auto: Auto demand: Manual disabled: Disable
Set Strt=auto

echo Easyservice One-click Service
Echo ===========================================================
::p ause
:: ====================== The following parts do not modify ==========================
Set S32=%cd%\system32
Set Reg_file=easyservice.reg

net stop%service_name% 2>nulcopy instsrv.exe%s32%
Copy Srvany.exe%s32%

%s32%\instsrv.exe%service_name% Remove 2>nul
%s32%\instsrv.exe%service_name%%s32%\srvany.exe >nul

:: Set startup mode for service Auto: Auto demand: Manual disabled: Disable
sc config%service_name% start=%strt%
SC description%service_name% "%service_description%"

Echo generates the registry file ...
echo Windows Registry Editor Version 5.00 >%reg_file%
echo [Hkey_local_machine\system\currentcontrolset\services\%service_name%\parameters] >>%reg_file%
echo "Application" = "%prog_path%" >>%reg_file%

Echo Import Registry File ...
%reg_file%

net start%service_name%
echo =========================== Complete ============================
Pause is saved as bat, and the programs and bat+instsrv.exe+srvany.exe that need to be registered are placed in the same directory and executed bat can be linked: Https://pan.baidu.com/s/1pLdf7oJ password: Ajmi

Registering a Windows application as a Windows service

Related Article

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.