Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
Im trying to make a batch as follows:
I want the file to open and scroll out whatever I typed in the batch file instead of just showing all the text at once.
Basically animate my text as if you were typing it as you read it.
Thanks for your help.
HandyAndy

Here's my attempt.
@ECHO OFF setlocal set fn=%~f1 if not exist "%fn%" set /p fn=Plese type in a file name, you may also need to enter the full path if the file isn't in the same directory: cls for /f "delims=" %%a in ('type "%fn%"^|find /n /v ""') do ( set line="%%a" SETLOCAL ENABLEDELAYEDEXPANSION set lb= call :strip int ern :strip if "%~1%~2"=="intern" ( if "!line:~0,1!"=="]" ( set line="!line:~1! goto :eof ) else ( set line=!line:~1! goto strip )) if !line!=="" set lb=1 set line=!line:~1,-1! call :loop int ern :loop if "%~1%~2"=="intern" ( if defined line ( set /p =!line:~0,1!<nul >nul ping 0.0.0.0 -n 1 set line=!line:~1! goto loop ) else ( if defined lb ( >nul ping 0.0.0.0 -n 1 echo. )) echo. goto :eof ) endlocal ) pause endlocal

I have made a little change to the above script to allow files that contain "=" to be displayed properly to screen using a control character(^h - hex 08) to work around set /p's apparent inability of "prompt string" to begin with =. Doesn't work properly to file though, half full of control characters that don't convert properly using for or type....
@ECHO OFF setlocal set fn=%~f1 if not exist "%fn%" set /p fn=Plese type in a file name, you may also need to enter the full path if the file isn't in the same directory: cls for /f "delims=" %%a in ('type "%fn%"^|find /n /v ""') do ( set line="%%a" SETLOCAL ENABLEDELAYEDEXPANSION set lb= call :strip int ern :strip if "%~1%~2"=="intern" ( if "!line:~0,1!"=="]" ( set line="!line:~1! goto :eof ) else ( set line=!line:~1! goto strip )) if !line!=="" set lb=1 set line=!line:~1,-1! call :loop int ern :loop if "%~1%~2"=="intern" ( if defined line ( set /p = !line:~0,1!<nul >nul ping 0.0.0.0 -n 1 set line=!line:~1! goto loop ) else ( if defined lb ( >nul ping 0.0.0.0 -n 1 echo. )) echo. goto :eof ) endlocal ) pause endlocalIn case anyone is interested it is possible to sc stop beep then use (^G -hex 07) without the leading character to output to a text file, sc start beep the parse the text file using for /f and !var:=!, unless of course the file is ment to contain .

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |