欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

bat 文件用 windows terminal启动方法

程序员文章站 2022-06-15 22:57:37
...

game.bat

@echo off
if not defined bflag set bflag=1 && start wt --title "game" %0 && exit

cd /d %~dp0

set CURRENT_DIR=%cd%
set SERVER_BIN_PATH=%CURRENT_DIR%\..

pushd %SERVER_BIN_PATH%\bin
serverHolder.exe res\lua\server\game\start-up.lua
popd

gate1.bat

@echo off
if not defined bflag set bflag=1 && start wt --title "gate1" %0 && exit

cd /d %~dp0

set CURRENT_DIR=%cd%
set SERVER_BIN_PATH=%CURRENT_DIR%\..

pushd %SERVER_BIN_PATH%\bin
serverHolder.exe res\lua\server\gate1\start-up.lua
popd

login.bat

@echo off
if not defined bflag set bflag=1 && start wt --title "login" %0 && exit
cd /d %~dp0

set CURRENT_DIR=%cd%
set SERVER_BIN_PATH=%CURRENT_DIR%\..

pushd %SERVER_BIN_PATH%\bin
serverHolder.exe res\lua\server\login\start-up.lua
popd

serverBatch.bat

@echo off

taskkill /f /im serverHolder.exe

cd /d %~dp0

set CURRENT_DIR=%cd%


set batNameList=center, game, gate1, login, register
for %%I in (%batNameList%) do (
	echo %%I
	start call %CURRENT_DIR%\%%I.bat
)

PS

%0 指代脚本本身
执行完此句

if not defined bflag set bflag=1 && start wt --title "game" %0 && exit

以后会执行wt后面的脚本,也就是词句后面的代码

cd /d %~dp0

set CURRENT_DIR=%cd%
set SERVER_BIN_PATH=%CURRENT_DIR%\..

pushd %SERVER_BIN_PATH%\bin
serverHolder.exe res\lua\server\game\start-up.lua
popd

从而达到windows terminal 执行bat文件的效果

相关标签: 游戏方面