使用批处理文件关闭特定游戏后如何启动.exe

时间:2019-02-19 07:46:08

标签: batch-file explorer

我刚刚使用关闭Windows进程explorer.exe的批处理文件执行了此代码。它会启动其他一些有助于结结和关闭explorer.exe的程序。

是要开始游戏,我需要打开启动器,但是我想在启动游戏时关闭启动器。游戏是 fortnite 。在代码中,它以explorer.exe结尾,但是当我关闭 fortnite (不是启动器)时,我希望explorer.exe启动。

代码:

START C:\"Program Files (x86)"\"Epic Games"\Launcher\Portal\Binaries\Win32\EpicGamesLauncher.exe
START C:\Users\Yqmxh\Documents\Optimization(s)\TimerResolution.exe
START C:\Users\Yqmxh\Documents\Optimization(s)\"Mz Game Accelerator.lnk"
Taskkill /F /IM explorer.exe
start /wait "C:\Windows\explorer.exe"
exit

1 个答案:

答案 0 :(得分:0)

我不知道这会消耗多少cpu时间,但至少会起作用:

:beginning
tasklist | FIND "FortniteClient-Win64"
IF NOT %ERRORLEVEL% == 1 (ECHO process was found
ECHO now waiting for six seconds
PING localhost -n 6 >NUL
GOTO beginning
)
ECHO the EXE is not running anymore
explorer

由于我认为FOR循环太复杂了,所以我选择了GOTO,希望我不会对此感到失望;)

我认为这很容易解释,但是如果我错了,请随时询问。

相关问题