Just for fun - cmd animation

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kpropell
Posts: 14
Joined: 24 Aug 2009 10:11

Just for fun - cmd animation

#1 Post by kpropell » 25 Feb 2010 14:10

Hi!
Been enjoying the dostips'tips and for fun, I want to make myself a small animation snipple displayed in cmd.exe...
But! I can't find (probably bad use of googleing?) a way to delay execution of next command to under a second. One second delay between the .txt
files is just terrible. Soooo, is there a way?

And the "code" could have a better solution I would think, but I don't know where to begin. Right now I'm doing it like this:

cls
type 1.txt
1 second delay
cls
type 2.txt
1 second delay
cls

But could it be possible to just tell cmd.exe to print all the 'txt files one at a time with x delay in-between and enjoy the show?

-Tudelu Kjell :)

edit:
I forgot, does a "graphics" library exists for cmd? Would be fun having multiple colours!

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Just for fun - cmd animation

#2 Post by !k » 25 Feb 2010 17:22

Yes, you are bad use of googleing.

Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion
for %%f in (*.txt) do (
cls &color !random:~0,1!!random:~-1!
type "%%f"
ping localhost -n 2 >nul
)
cls &color
echo That's All Folks!

kpropell
Posts: 14
Joined: 24 Aug 2009 10:11

Re: Just for fun - cmd animation

#3 Post by kpropell » 25 Feb 2010 18:07

I've read that one! I figured out how to delay between the txt-files, but is 0.5 seconds possible?
Thanks for the 'for and colour thing' tho ;) Just have to name the txt files better so that it fits in.!
If 1 second is minimum all usefulness will be that clock I soon got done.. Humhum :D

Search continues!

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Just for fun - cmd animation

#4 Post by aGerman » 26 Feb 2010 07:02

You need a 3rd party app. You could write your own VBScript using batch.

Code: Select all

@echo off &setlocal

:: write the script
set "sleep=%temp%\sleep.vbs"
>%sleep% echo WScript.Sleep WScript.Arguments(0)

echo START
:: call the script with milli seconds as the parameter
%sleep% 200
echo END

pause

Note that calling the script takes some time. Thats why write less than 500 if you need 0.5 seconds

Regards
aGerman

Post Reply