Last active
December 20, 2015 04:49
-
-
Save davidruhmann/6073962 to your computer and use it in GitHub Desktop.
[Batch] Typing routine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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