T3RRYT3RR0R

Non blocking key input

Sep 24th, 2021
805
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Echo off
  2.  
  3.  Del "%~n0_*.~K" 2> nul
  4.  If not "%1"=="" Goto:%1
  5.  
  6.  Start "" /b "%~f0" Thread2
  7.  break>"%~n0_Key.~K"
  8.  Title 0 to stop
  9.  Setlocal EnableDelayedExpansion
  10.  For /l %%. in ()Do (
  11.   (For /f "usebackq delims=" %%K in ("%~n0_Key.~K") Do Set "Key=%%K") 2> nul
  12.   If "!Key!"=="0" (
  13.    Endlocal
  14.    EXIT
  15.   )Else <nul set /p "=!Key!"
  16.  )
  17.  
  18.  
  19. :Thread2
  20.  (For /l %%i in ()Do if not exist "%~n0_End.~K" (
  21.    For /f "delims=" %%G  in ('Choice.exe /n /c:"0123456789abcdefghijklmnopqrstuvwxyz"')Do (
  22.     >"%~n0_Key.~K" Echo(%%G
  23.     If %%G==0 exit
  24.    )
  25.   )Else EXIT
  26.  ) 2> nul
  27. Goto:Thread2
RAW Paste Data