你看这样行不行?
我还没测试。。。。
@echo off&setlocal ENABLEDELAYEDEXPANSION
set n=1
:star
ping 127.1 -n 5 >nul 2>nul
tasklist |findstr /i "ansys.exe"
if %errorlevel%==0 (
goto exist
) else (
goto notexist
)
:exist
ren D:\result\beam.txt d:\result\beam!n!.txt
if %errorlevel%==0 (
set /a n=!n!+1
goto star
) else (
goto star
)
:notexist
goto exit
:exit
shutdown /f /s /t 50
exit