MSFN Forum: Count down in a batch file - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Count down in a batch file Rate Topic: -----

#1 User is offline   sixpack 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 515
  • Joined: 29-May 04

Posted 03 December 2004 - 02:57 AM

hi
is it posible to have a visible Count down in a batch file
what i mean is this:
this window closes in 5 seconds, and it Counts down visible
:)


#2 User is offline   army20 

  • MCSA, MCDST, MCTS (vista), A+ (2003)
  • PipPipPipPip
  • Group: Members
  • Posts: 522
  • Joined: 01-September 04

  Posted 03 December 2004 - 04:00 AM

Removed

#3 User is offline   sixpack 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 515
  • Joined: 29-May 04

Posted 03 December 2004 - 04:46 AM

Sorry to say this but it doesed work over here
and i did use CLS

#4 User is offline   jdoe 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 314
  • Joined: 02-May 04

Posted 03 December 2004 - 11:40 AM

sixpack, on Dec 3 2004, 03:57 AM, said:

hi
is it posible to have a visible Count down in a batch file
what i mean is this:
this window closes in 5 seconds, and it Counts down visible
:)


You again :P

With all those questions about batch file you had lately, you're going to raise your knowledge.

Don't forget search button and Google are your friend and reading others batches can help a lot either.


5 seconds countdown
@echo off
echo this window closes in 5 seconds
echo.
echo 5
ping -n 2 127.0.0.1>nul
echo 4
ping -n 2 127.0.0.1>nul
echo 3
ping -n 2 127.0.0.1>nul
echo 2
ping -n 2 127.0.0.1>nul
echo 1
ping -n 2 127.0.0.1>nul

pause



:)

#5 User is offline   sixpack 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 515
  • Joined: 29-May 04

Posted 03 December 2004 - 12:17 PM

jdoe, on Dec 3 2004, 06:40 PM, said:

sixpack, on Dec 3 2004, 03:57 AM, said:

hi
is it posible to have a visible Count down in a batch file
what i mean is this:
this window closes in 5 seconds, and it Counts down visible
:)


You again :P

With all those questions about batch file you had lately, you're going to raise your knowledge.

Don't forget search button and Google are your friend and reading others batches can help a lot either.


5 seconds countdown
@echo off
echo this window closes in 5 seconds
echo.
echo 5
ping -n 2 127.0.0.1>nul
echo 4
ping -n 2 127.0.0.1>nul
echo 3
ping -n 2 127.0.0.1>nul
echo 2
ping -n 2 127.0.0.1>nul
echo 1
ping -n 2 127.0.0.1>nul

pause



:)

COOL jdoe i had only:
ping -n 5 127.0.0.1>nul

so i did know but not all

only i did not know that i can use it this way ;)

btw believe me i use googel and when i do not find it i ask here

#6 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 14 December 2004 - 02:50 AM

I am not a coder but here what i worked out.
echo off
cls && mode con: Cols=55 Lines=5 && Color 9f && TITLE COUNTDOWN
 > Rest1.vbs Echo Wscript.sleep 875 && SET R1=Start /w Rest1.vbs
CLS
ECHO. && Echo .5 && ECHO COUNTDOWN 5 >> Test.txt && %R1% && CLS && ECHO. && Echo ..4 && ECHO COUNTDOWN 4 >> Test.txt &&  %R1% && CLS
ECHO. && Echo ...3 && ECHO COUNTDOWN 3 >> Test.txt &&  %R1% && CLS && ECHO. && ECHO ....2 && ECHO COUNTDOWN 2 >> Test.txt &&  %R1%
CLS && ECHO. && ECHO .....1 && ECHO COUNTDOWN 1 >> Test.txt &&  %R1% && CLS && COLOR F2
ECHO. && ECHO  CONTINUE >> Test.txt
SET /P = CONTINUE
DEL REST1.VBS && Test.txt
DEL Test.txt


#7 User is offline   sixpack 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 515
  • Joined: 29-May 04

Posted 14 December 2004 - 01:44 PM

gunsmokingman, on Dec 14 2004, 09:50 AM, said:

I am not a coder but here what i worked out.
echo off
cls && mode con: Cols=55 Lines=5 && Color 9f && TITLE COUNTDOWN
 > Rest1.vbs Echo Wscript.sleep 875 && SET R1=Start /w Rest1.vbs
CLS
ECHO. && Echo .5 && ECHO COUNTDOWN 5 >> Test.txt && %R1% && CLS && ECHO. && Echo ..4 && ECHO COUNTDOWN 4 >> Test.txt &&  %R1% && CLS
ECHO. && Echo ...3 && ECHO COUNTDOWN 3 >> Test.txt &&  %R1% && CLS && ECHO. && ECHO ....2 && ECHO COUNTDOWN 2 >> Test.txt &&  %R1%
CLS && ECHO. && ECHO .....1 && ECHO COUNTDOWN 1 >> Test.txt &&  %R1% && CLS && COLOR F2
ECHO. && ECHO  CONTINUE >> Test.txt
SET /P = CONTINUE
DEL REST1.VBS && Test.txt
DEL Test.txt

works nice i'l be useing yours then ;)
thanks

#8 User is offline   DataCracker7899 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 02-January 13
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 13 January 2013 - 05:06 AM

Download the scripts from my page. There is no viruses,malware ,spyware or anything harmful.
it's a ZIP file that has 2 files in it One is Executable and other one batch.
DOWNLOAD HERE: HERE!
or from below!

/.G7NANOZ_ANDRE7899 :thumbup

Attached File(s)


This post has been edited by DataCracker7899: 13 January 2013 - 05:08 AM


#9 User is offline   FixitUP 

  • Newbie
  • Group: Banned
  • Posts: 47
  • Joined: 17-November 12
  • OS:XP Pro x86
  • Country: Country Flag

Posted 13 January 2013 - 08:10 AM

Nice coding.

How would I get it to exit instead of continue ?

Thanks.

#10 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 13 January 2013 - 10:26 AM

You may find the following fun!
@MODE CON: COLS=32 LINES=1
@COLOR E5
@TITLE Countdown
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /F %%# IN ('COPY /Z "%~dpf0" NUL') DO SET "CR=%%#"
FOR /L %%# IN (10,-1,1) DO (SET/P "=Script will end in %%# seconds. !CR!"<NUL:
	PING -n 2 127.0.0.1 >NUL:)
The first three lines are pointless additions which can be removed, change the 10 in the second 'FOR loop' to the number of seconds you wish to count down from.

#11 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 13 January 2013 - 01:18 PM

On Windows 7 they have a exe called Timeout

Quote

Description:
This utility accepts a timeout parameter to w
time period (in seconds) or until any key is
accepts a parameter to ignore the key press.


Parameter List:
    /T        timeout       Specifies the number of seconds to wait.
                            Valid range is -1 to 99999 seconds.

    /NOBREAK                Ignore key presses and wait specified time.

    /?                      Displays this help message.

 NOTE: A timeout value of -1 means to wait indefinitely for a key press.



Examples:
    TIMEOUT /?
    TIMEOUT /T 10
    TIMEOUT /T 300 /NOBREAK
    TIMEOUT /T -1



#12 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 13 January 2013 - 01:39 PM

View Postgunsmokingman, on 13 January 2013 - 01:18 PM, said:

On Windows 7 they have a exe called Timeout

Just change the last line of my above example to read:
	>NUL TIMEOUT /T 1)


#13 User is offline   AceInfinity 

  • Newbie
  • Group: Members
  • Posts: 22
  • Joined: 10-August 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 02 February 2013 - 06:14 PM

Here's a wait animation I wrote a while back, Only it's not based on a countdown:

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET /A numtimes=3
FOR /L %%G in (1,1,%numtimes%) DO (
	CALL :WaitDisplay "Please Wait"
)
CLS
ECHO Done! Press any key to finish...

PAUSE > NUL & GOTO :EOF

:WaitDisplay
SET string=%1
SET string=%string:"=%
SET dots=...

FOR /l %%G in (1,1,3) DO (
	CLS
	ECHO !string!!dots:~0,%%G!
	PING localhost -n 2 -w 500 -l 5000 > NUL
)


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy