|to run in full screen, only way with the above script i can think of is to run the thread at the same screen. here the buggy-coding: Type timeout to test.|
::start a new thread and run the (code %2)
%~1 start /b %0 :: "" :: & goto :eof
::start the timer thread and run (code %3)
%~2 start /b %0 :: :: ""
::get user input
%~2 set /p str=input barcode string in 10sec:
%~2 set str
::sleep for 10second
%~3 ping -n 10 127.0.0.1 >nul
%~3 echo TIMEOUT!
::kill the above 2 threads, after user input string or timeout
for /f "skip=3 tokens=1,2*" %%a in ('tasklist /fi "imagename eq cmd.exe" /fi "windowtitle ne %ComSpec%*"') do (
taskkill /F /PID %%b >nul 2>&1)
the problem now is the set /p is not working as it should be. you have to press enter once, then input data and press enter again for it to work.
i also dont undestand why the following code doesnt work, instead i have to workaround using for loop:
taskkill /fi "imagename eq cmd.exe" /fi "windowtitle ne %ComSpec%*"
no more idea. sorry.
if there is a command to switch window similar to taskmgr.exe, then it can be done.