zoukankan      html  css  js  c++  java
  • SC创建服务编写bat脚本

    新建bat脚本,并写入一下文本保存

    sc create "DevFast.SupportGPSWarmService" binpath= "%cd%DevFast.SupportGPSWarmService.exe /S" type= own start= auto obj= localsystem Displayname= "DevFast.SupportGPSWarmService"
    sc start "DevFast.SupportGPSWarmService"
    
    pause

    sc stop "DevFast.SupportGPSWarmService"
    
    sc delete "DevFast.SupportGPSWarmService"
    
    pause

    卸载服务:先停止服务,再删除服务

     参数详情:

    sc [servername] create Servicename [Optionname= Optionvalues] 
    这里的servername,servicename,optionname,optionvalues和上面的一样,这里就不多说了。这里我们详细说 
    明一下optionname和optionvalues。 
    Optionname--Optionvalues 
    描述 
    type=----own, share, interact, kernel, filesys 
    关于建立服务的类型,选项值包括驱动程序使用的类型,默认是share。 
    start=----boot, sys tem, auto, demand, disabled 
    关于启动服务的类型,选项值包括驱动程序使用的类型,默认是demand(手动)。 
    error=----normal, severe, critical, ignore 
    当服务在导入失败错误的严重性,默认是normal。 
    binPath=--(string) 
    服务二进制文件的路径名,这里没有默认值,这个字符串是必须设置的。 
    group=----(string) 
    这个服务属于的组,这个组的列表保存在注册表中的ServiceGroupOrder下。默认是nothing。 
    tag=----(string) 
    如果这个字符串被设置为yes,sc可以从CreateService call中得到一个tagId。然而,SC并不显示这个标签,所 
    以使用这个没有多少意义。默认是nothing 
    depend=----(space separated string)有空格的字符串。 
    在这个服务启动前必须启动的服务的名称或者是组。 
    obj=----(string) 
    账号运行使用的名称,也可以说是登陆身份。默认是localsys tem 
    Displayname=--(string) 
    一个为在用户界面程序中鉴别各个服务使用的字符串。 
    password=--(string) 
    一个密码,如果一个不同于localsystem的账号使用时需要使用这个。 
  • 相关阅读:
    python 玩转列表list
    Python入门之_水仙花数
    自兴人工智能 字符串
    自兴人工智能 元组
    自兴人工智能 列表
    自兴人工智能 python特点了解
    python走迷宫
    (自兴人工智能) python 元组
    (自兴人工智能) 玩转 python 字符串
    (自兴人工智能)Python 列表(List)的灵活使用
  • 原文地址:https://www.cnblogs.com/MrZheng/p/10919291.html
Copyright © 2011-2022 走看看