將windows應用程式註冊為windows服務

來源:互聯網
上載者:User

標籤:一鍵   sts   top   local   部分   script   修改   editor   gem   

@echo off
 
::設定服務名稱
set service_name=ServiceManagement
 
::設定服務描述
set service_description=檔案安全上傳服務
 
::設定服務程式路徑
set prog_path=%cd:\=\\%\\ServiceManagement.exe
 
::設定服務的啟動方式 auto:自動 demand:手動 disabled:禁用
set strt=auto
 
echo                    EasyService 一鍵服務
echo ===========================================================
::pause
::======================以下部分勿隨意修改==========================
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
 
::設定服務的啟動方式 auto:自動 demand:手動 disabled:禁用
sc config %service_name% start= %strt%
sc description %service_name% "%service_description%"
  
echo 產生註冊表檔案...
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 匯入註冊表檔案...
%reg_file%
 
net start %service_name%
echo ===========================完成============================
pause 儲存為bat,將需要註冊的程式和bat+instsrv.exe+srvany.exe放到同一個目錄裡邊執行bat就可以 連結: https://pan.baidu.com/s/1pLdf7oJ 密碼: ajmi

將windows應用程式註冊為windows服務

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.