How to replace last line in Windows batch code? -
i trying make text-based game, , when user enters something, want computer's character have kind of thinking animation.
i've come this: [. ] [.. ] [...]
only problem is, want on 1 line, it's actual animation. i've recreated without removed text echo'd, requires cls, send on screen before, three times. takes space , pretty inefficient.
i found code changes last without clearing before it,
@echo off echo won't disappear! setlocal enabledelayedexpansion /f %%a in ('copy /z "%~f0" nul') set "cr=%%a" /l %%n in (5 -1 1) ( <nul set /p "=this window close in %%n seconds!cr!" ping -n 2 localhost > nul )
it counts down without erasing echo before, not understand how adapt add periods string... know way this? thanks!
you there code found; need use own text instead of else's.
for /l %%a in (1,1,3) ( set /p "=."<nul ping -n 2 localhost >nul )
if want put periods inside of brackets, can use this:
for /f %%a in ('"prompt $h &echo on &for %%b in (1) rem"') set bs=%%a set /p "=[ ]"<nul ping -n 2 localhost >nul set /p "=%bs%%bs%%bs%%bs%. ]"<nul ping -n 2 localhost >nul set /p "=%bs%%bs%%bs%. ]"<nul ping -n 2 localhost >nul set /p "=%bs%%bs%.]"<nul ping -n 2 localhost >nul
Comments
Post a Comment