REM start the program as quickly as possible to avoid other processes starting
tasklist > file1.txt & start notepad.exe & tasklist > file2.txt
REM Find the PID of the program we just started
for /f "tokens=2" %%a in ('fc file1.txt file2.txt^|find "notepad.exe"') do set PID=%%a
REM delay for 5 seconds
FOR /l %%a in (5,-1,1) do (Echo closing in %%as&ping -n 2 -w 1 127.0.0.1>NUL)
REM delete the program using it's PID
tskill %PID%
o ping -n 2 -w 1 127.0.0.1
fará uma pausa por quase exatamente 1 segundo (a quantidade de tempo entre dois pings)
Isso funciona no XP, já que choice
não está incluído no XP