@璐村惂鐢ㄦ埛_000076K馃惥 off
setlocal enabledelayedexpansion
:start_program
start "" "C:\path\to\your\program.exe"
timeout /t 5
:: 使用WMIC获取程序的PID
for /f "tokens=*" %%i in ('wmic process where "name='program.exe'" get ProcessId ^| findstr /r "[0-9]"') do (
set program_pid=%%i
)
echo Program PID: !program_pid!
timeout /t 60
taskkill /f /pid !program_pid!
goto start_program
setlocal enabledelayedexpansion
:start_program
start "" "C:\path\to\your\program.exe"
timeout /t 5
:: 使用WMIC获取程序的PID
for /f "tokens=*" %%i in ('wmic process where "name='program.exe'" get ProcessId ^| findstr /r "[0-9]"') do (
set program_pid=%%i
)
echo Program PID: !program_pid!
timeout /t 60
taskkill /f /pid !program_pid!
goto start_program