启动应用程序或者服务
新建txt文件,更改文件后缀并重命名为start.bat。
打开后编辑,写入需要启动的应用程序或者服务。以下为我的start.bat的内容,应用程序可执行程序文件路径可在桌面快捷方式右键属性里查看。
start "" "C:\Program Files\Google\Chrome\Application\chrome.exe"
start "" "F:\Microsoft VS Code\Code.exe"
start "" "F:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\bin\idea64.exe"
start "" "C:\Program Files (x86)\Tencent\WeChat\WeChat.exe"
start "" "explorer"
关闭应用程序或者服务
方式如上,建立shutup.bat,文件内容如下:
net stop kibana
net stop logstash
net stop elasticsearch-service-x64
taskkill /f /t /im chrome.exe
taskkill /f /t /im Code.exe
taskkill /f /t /im idea64.exe
taskkill /f /t /im WeChat.exe
taskkill /f /t /im Cmder.exe
taskkill /f /t /im MySQLWorkbench.exe
shutdown /s
前三个为关闭服务,最后一个为关机命令,中间为关闭应用程序命令。
关闭应用程序需指定/f /t /im参数:
- /f:指示强制终止进程。
- /t:终止指定的进程和由它启用的子进程。
- /im:指定要终止的进程的映像名称。通配符 '*'可用来指定所有任务或映像名称。
停止服务需要以管理员方式执行命令。