I have here a batch file that works when i double click it. However, running this batch file through php launches notepad and just kills it right away.
START C:\Windows\NOTEPAD.EXE
timeout /t 60
taskkill /im "NOTEPAD.EXE" /f
Is there any reason why timeout doesn't work? Any help is appreciated. Thanks!
Edit: I have refactored the code but pause also gets skipped.
START C:\Windows\NOTEPAD.EXE
..\..\..\Windows\System32\timeout.exe /t 1000
pause
taskkill /im "NOTEPAD.EXE" /f
Try using a PING timeout to see if it fixes the problem with delay..
PING -n 60 127.0.0.1>nul
https://ss64.com/nt/timeout.html
Timeout will pause command execution for a number of seconds, after which it continues without requiring a user keystroke. If the user does press a key at any point, execution will resume immediately.
A delay can also be produced by the PING command with a loopback address, there is a delay of 1 second between each consecutive ping.
In tests PING consumes less processor time than Sleep.exe or Timeout.exe, this allows other processes to run in the background. The PING command can only be interrupted with Ctrl-C. Source: Clay Calvert (usenet 2001.)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments