Skip to content

Instantly share code, notes, and snippets.

@davidruhmann
Last active December 20, 2015 04:49
Show Gist options
  • Save davidruhmann/6073962 to your computer and use it in GitHub Desktop.
Save davidruhmann/6073962 to your computer and use it in GitHub Desktop.
[Batch] Typing routine
@echo off
call :Typing "hello world!"
exit /b 0
:: Use a known invalid reserved IP address because it should always timeout.
:: http://en.wikipedia.org/wiki/Reserved_IP_addresses
:: 127.0.0.1 will never timeout and will always return each tick in 1 second.
:Typing <Message>
setlocal
set "Message=%~1"
:TypingLoop
ping 192.0.2.0 -n 1 -w 500 >nul
if "%Message:~1,1%"==" " ( <nul set /p "=%Message:~0,2%" ) else ( <nul set /p "=%Message:~0,1%" )
set "Message=%Message:~1%"
if defined Message goto TypingLoop
endlocal
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment