• windows 服务的安装与卸载之bat脚本命令


    在windows 平台下,服务的安装与卸载可通过bat 脚本命令来完成,同时可编辑服务的描述,具体代码如下:

    1.服务的安装DynamicPlanService_installer.bat:

    @echo ===============================   动态排产服务   =============================
    @echo ==============================  Version:V1.0.0   ============================
    @echo ===========================   Created:2018-12-24  ===========================
    @echo ======================= ServiceName:DynamicPlanService ======================
    @echo ================ Copyright: @2017-2019 Will All Rights Reserved. =============
    @echo.
    @echo.
    @echo.
    
    
    @echo off
    
    %1 %2
    ver|find "5.">nul&&goto :st
    mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",1)(window.close)&goto :eof
    :st
    copy "%~0" "%windir%system32"
    
    sc create DynamicPlanService binPath= "D:ProjectItemsWorkSpaceGJ_GWZD_SYDynamicPlanService.exe"
    sc config DynamicPlanService start= AUTO
    sc description DynamicPlanService  "动态排产服务,根据每日执行情况进行重新自动计算。每天的零时在后台自动执行,将计算出工序的全部信息,特别是精确的投料和产出的时间"
    net start DynamicPlanService 
    
    @echo.
    @pause
    

     2. 服务卸载 DynamicPlanService_Uninstaller.bat

    @echo ===============================   动态排产服务   =============================
    @echo ==============================  Version£ºV1.0.0   ============================
    @echo ===========================   Created£º2018-12-24  ===========================
    @echo ======================= ServiceName£ºDynamicPlanService ======================
    @echo ================ Copyright: @2017-2019 Will All Rights Reserved. =============
    @echo.
    @echo.
    @echo.
    
    
    @echo off
    
    %1 %2
    ver|find "5.">nul&&goto :st
    mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",1)(window.close)&goto :eof
    :st
    copy "%~0" "%windir%system32"
    
    net stop DynamicPlanService 
    sc delete DynamicPlanService binPath= "D:ProjectItemsWorkSpaceGJ_GWZD_SYDynamicPlanService.exe"
    
    @echo.
    @pause
    

      

  • 相关阅读:
    2/4 关于 Vue.js 中 this.$nextTick 的个人简单解释
    2/3 初次搭建 Vue 项目遇到的问题汇总
    前端中常见的布局
    如何判断一个变量是否为数组(isArray)
    ubuntu下安装截图工具
    正向代理、反向代理
    javascript中的基本数据类型
    css3 中的渐变
    javascript中的toString()
    ubuntu下面安装nodejs
  • 原文地址:https://www.cnblogs.com/wisdo/p/10460913.html
Copyright © 2020-2023  润新知