项目开发中很多情况下,我们需要执行多个脚本,尤其集群环境下,像启动nacos集群,就需要对多个cmd脚本启动,很是麻烦。于是,我对网上针对批处理指令进行了收集和整理,还有测试。如下几个亲测有效,可以参考下。
@echo off
start call ./nacos/bin/startup.cmd -m cluster
start call ./nacos-2/bin/startup.cmd -m cluster
start call ./nacos-3/bin/startup.cmd -m cluster
@echo off
start /D "./nacos/bin/" startup.cmd -m cluster
start /D "./nacos-2/bin/" startup.cmd -m cluster
start /D "./nacos-3/bin/" startup.cmd -m cluster
@echo off
start call ./echo/echo.bat aa
start call ./echo/echo2.bat bb
echo.bat 脚本
@echo off
echo hello %1