window批量启动程序脚本,隐藏dos窗口

350 阅读1分钟

目录结构

image.png

start.bat 脚本内容

@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
Rem 设定当前bat所在目录为执行目录,下面的程序可以使用相对目录
set curdir=%~dp0
cd /d %curdir% 
Rem start /b 为后台执行
Rem >> 将日志追加到文件
start /b dir1/a.exe  -port 8000 >>dir1/a.log
start /b dir2/b.exe -port 8001 >>dir2/b.log
cd /d %curdir% 
cd nginx
start nginx