sixpack Posted December 3, 2004 Posted December 3, 2004 hiis it posible to have a visible Count down in a batch filewhat i mean is this:this window closes in 5 seconds, and it Counts down visible
jdoe Posted December 3, 2004 Posted December 3, 2004 hiis it posible to have a visible Count down in a batch filewhat i mean is this:this window closes in 5 seconds, and it Counts down visible You again 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 offecho this window closes in 5 secondsecho.echo 5ping -n 2 127.0.0.1>nulecho 4ping -n 2 127.0.0.1>nulecho 3ping -n 2 127.0.0.1>nulecho 2ping -n 2 127.0.0.1>nulecho 1ping -n 2 127.0.0.1>nulpause
sixpack Posted December 3, 2004 Author Posted December 3, 2004 hiis it posible to have a visible Count down in a batch filewhat i mean is this:this window closes in 5 seconds, and it Counts down visible You again 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 offecho this window closes in 5 secondsecho.echo 5ping -n 2 127.0.0.1>nulecho 4ping -n 2 127.0.0.1>nulecho 3ping -n 2 127.0.0.1>nulecho 2ping -n 2 127.0.0.1>nulecho 1ping -n 2 127.0.0.1>nulpause COOL jdoe i had only:ping -n 5 127.0.0.1>nulso i did know but not allonly 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
gunsmokingman Posted December 14, 2004 Posted December 14, 2004 I am not a coder but here what i worked out.echo offcls && mode con: Cols=55 Lines=5 && Color 9f && TITLE COUNTDOWN > Rest1.vbs Echo Wscript.sleep 875 && SET R1=Start /w Rest1.vbsCLSECHO. && Echo .5 && ECHO COUNTDOWN 5 >> Test.txt && %R1% && CLS && ECHO. && Echo ..4 && ECHO COUNTDOWN 4 >> Test.txt && %R1% && CLSECHO. && 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 F2ECHO. && ECHO CONTINUE >> Test.txtSET /P = CONTINUEDEL REST1.VBS && Test.txtDEL Test.txt
sixpack Posted December 14, 2004 Author Posted December 14, 2004 I am not a coder but here what i worked out.echo offcls && mode con: Cols=55 Lines=5 && Color 9f && TITLE COUNTDOWN > Rest1.vbs Echo Wscript.sleep 875 && SET R1=Start /w Rest1.vbsCLSECHO. && Echo .5 && ECHO COUNTDOWN 5 >> Test.txt && %R1% && CLS && ECHO. && Echo ..4 && ECHO COUNTDOWN 4 >> Test.txt && %R1% && CLSECHO. && 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 F2ECHO. && ECHO CONTINUE >> Test.txtSET /P = CONTINUEDEL REST1.VBS && Test.txtDEL Test.txtworks nice i'l be useing yours then thanks
DataCracker7899 Posted January 13, 2013 Posted January 13, 2013 (edited) 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 G7 NANOSCRIPTZ - ZIP.zip Edited January 13, 2013 by DataCracker7899
FixitUP Posted January 13, 2013 Posted January 13, 2013 Nice coding.How would I get it to exit instead of continue ?Thanks.
Yzöwl Posted January 13, 2013 Posted January 13, 2013 You may find the following fun!@MODE CON: COLS=32 LINES=1@COLOR E5@TITLE Countdown@ECHO OFFSETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSIONFOR /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.
gunsmokingman Posted January 13, 2013 Posted January 13, 2013 On Windows 7 they have a exe called TimeoutDescription: 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
Yzöwl Posted January 13, 2013 Posted January 13, 2013 On Windows 7 they have a exe called TimeoutJust change the last line of my above example to read: >NUL TIMEOUT /T 1)
AceInfinity Posted February 3, 2013 Posted February 3, 2013 Here's a wait animation I wrote a while back, Only it's not based on a countdown:@ECHO OFFSETLOCAL ENABLEDELAYEDEXPANSIONSET /A numtimes=3FOR /L %%G in (1,1,%numtimes%) DO ( CALL :WaitDisplay "Please Wait")CLSECHO Done! Press any key to finish...PAUSE > NUL & GOTO :EOF:WaitDisplaySET string=%1SET 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)
gunsmokingman Posted June 27, 2013 Posted June 27, 2013 Since this is a older thread and the original poster requested Cmd with countdown, I just recently wrotethis VBS script that has a countdown and you can cancel the countdown.'-> Object For RuntimeDim Act :Set Act = CreateObject("Wscript.Shell")'-> Set The Amout Of Time For Count DownDim S1 :S1 = 15Main() Function Main() If S1 = 0 Then'-> Script Action For Time Out MsgBox "Script Place Holder, Time Out",4128,"Demo CountDown" WScript.Quit End If '-> add Zero EG 9 = 009 If Len(S1) = 1 Then S1 = "00" & S1 If Len(S1) = 2 Then S1 = "0" & S1 '-> Time Message Box If Act.Popup( "Time Left : " & S1 & vbCrLf & _ "Press Cancel To Exit And Stop",1,"Test Count Down",4129) = 2 Then MsgBox "User cancel",4128,"User Cancel" WScript.Quit End If S1 = S1 - 1 Main() End Function
stevielamb Posted October 26, 2013 Posted October 26, 2013 Hi all,I've just started using SyncToy to backup my data and I wanted it to be executed during the computer's log-out process. However, I also needed the option to cancel the sync process from running if, for example, it had already run earlier so I put together this little countdown batch script which seems to do the job nicely. Essentially, when the script is invoked it gives you 10 seconds to press the "Y" button to cancel (during which time a running countdown is displayed) and after the 10 seconds have elapsed if you haven't pressed the "Y" button it will proceed to run the SyncToy process:-@echo offset countdown=10:loopclschoice /C YN /n /t 1 /d N /M "Press Y to cancel sync. [%countdown%]"if %errorlevel%==1 ( echo Sync cancelled. Logging off... exit /B >nul)if %countdown% gtr 0 ( set /A countdown-=1 goto loop)echo Invoking SyncToy...CALL "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -Rexit /B 0Hopefully, this may prove useful to someone.All the best,Steve.
jaclaz Posted October 26, 2013 Posted October 26, 2013 @SteveThanks, though at first sight I am failing to see why you are not using a FOR /L loop. Also, how long does the message:Sync cancelled. Logging off...stay visible on screen? jaclaz
Yzöwl Posted October 26, 2013 Posted October 26, 2013 …also please be aware that choice is not available by default in all OS's.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now