zoukankan      html  css  js  c++  java
  • Windows批处理开启/停止服务及隐藏批处理窗口

    1、bat编写你要开启的服务

    @echo off
    %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
    net start Acunetix
    net start "Acunetix Database"
    pause
    
    
    
    

    2、bat编写你要停止的服务

    @echo off
    @sc stop Acunetix
    @sc stop "Acunetix Database"
    

    3、Windows下隐藏批处理窗口

    @echo off
    if "%1"=="h" goto begin
    start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
    :begin
    
    ::以下为正常批处理命令,不可含有pause set/p等交互命令
    
    pause
    

    注意:服务名称如果是多个字符中间有空格的话,需要给服务名加上双引号 ""

    echo on的意思是显示命令回显
    echo off的意思就是关闭回显
    在指令前加上“@”来无视当前回显状态,让某些指令关闭回显
    @echo off  不显示后续命令行及当前命令行
    pause 运行此句会暂停批处理的执行并在屏幕上显示Press any key to continue...的提示,等待用户按任意键后继续

    调用管理员权限:
    %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit

  • 相关阅读:
    响应式注意要添加“视口”约束标记---viewport
    js检测浏览器屏幕宽度
    Fragment中退出报错异常
    ListView和Gridview与滚动冲突解决
    APK反编译
    走出来,就要扛住
    与设备无法进行调试怎么走
    OC基础-protocol
    OC基础-变量可见对与方法
    OC基础-面向对象编程简介
  • 原文地址:https://www.cnblogs.com/qtzd/p/15569966.html
Copyright © 2011-2022 走看看