如何在批处理文件中退出多个应用程序?


@echo OFF
start /min "" "D:GamesDevil May Cry 5DMCVTrainer.exe"
start /min "" "D:GamesDevil May Cry 5SSSiyanCollabTU5_1.1_1.CT"
TIMEOUT /t 5
start "" "D:GamesDevil May Cry 5DevilMayCry5.exe"
:RUNNING
tasklist|findstr DevilMayCry5.exe > nul
if %errorlevel%==1 timeout /t 1 & taskkill /F /IM cheatengine-x86_64.exe /T % GOTO ENDLOOP
timeout /t 1
GOTO RUNNING
:ENDLOOP
exit /B

如何为其他应用程序exe添加另一个任务杀手,我已经尝试过:

if %errorlevel%==1 timeout /t 1 & taskkill /F /IM cheatengine-x86_64.exe /T taskkill /F /IM DMCVTrainer.exe /T & GOTO ENDLOOP

但它随后完全停止工作,不会关闭任何应用程序。

使用带括号的代码块。

if %errorlevel% equ 1 (
timeout /t 1
taskkill /F /IM cheatengine-x86_64.exe
taskkill /F /IM DMCVTrainer.exe
)

也许还可以考虑errorlevel而不是%errorlevel%

if errorlevel 1 (
timeout /t 1
taskkill /F /IM cheatengine-x86_64.exe
taskkill /F /IM DMCVTrainer.exe
)

最新更新