.bat countdown

denstieven Posted messages 717 Status Membre -  
 moi -
Hello everyone,

How to make a countdown that stays in place, so

Wait 10 seconds...

and then 10 becomes 9 ... 8 ... etc
Thank you for your help :)

Configuration: Windows 7 / Firefox 3.6.16

13 réponses

boly38 Posted messages 267 Registration date   Status Membre Last intervention   80
 
I was trying to do this in batch anyway, even though I will have a little trouble knowing what native commands exist under Seven..

I thought (as mentioned in the source I cited) about a ping for the wait (because that's really what - pun intended - pauses the problem..) but I am not satisfied with the precision obtained..

Here's what I propose (come on..... who can do better?)
 @echo off for /L %%i in (10,-1,1) do ( echo Please wait %%i sec PING 1.1.1.1 -n 1 -w 1000 >NUL ) 

Edit: explanations, for i going from 10 to 1 losing 1 each time, perform a ping to a non-existent address and a timeout of 1 sec while redirecting the output to NUL; then display the number of seconds remaining.
NB: sometimes it associates 2 commands at once, I don't know why?
5
moi
 
Awesome!
0
aldj36
 
I slightly modified boly38's program so that only the value of seconds changes

@echo off
for /L %%i in (10,-1,1) do (
echo Please wait %%i sec

PING 1.1.1.1 -n 1 -w 1000 >NUL
cls
)
ECHO END
pause

have a nice day
2
lucasnoob Posted messages 71 Status Membre 1
 
it’s the jars that do that (go to the zero site to learn Java ^^)
0
denstieven Posted messages 717 Status Membre 42
 
So it doesn't exist in batch?
0
lucasnoob Posted messages 71 Status Membre 1
 
Well maybe, but most of it is Java or something else.
0
denstieven Posted messages 717 Status Membre 42
 
JAVA? Oh ok, I will take a look.
0
boly38 Posted messages 267 Registration date   Status Membre Last intervention   80
 
there is the following command that does it all
 timeout 10 

src : https://www.robvanderwoude.com/wait.php
0
lucasnoob Posted messages 71 Status Membre 1
 
You create the Java file and then name it comptarebour.jar, and when you're done, you place it in a folder.

You create a .bat file and put this in it:

@echo off
title Ancestra Remake V0.5.4 Rev 33 Compiled by Demien
:loop
Java -jar -Xmx 5m -Xms 5m comptarebour.jar
goto loop
PAUSE

I believe you need to make sure the .bat is in the same folder as comptarebour.jar.
0
denstieven Posted messages 717 Status Membre 42
 
Alright, thank you, I will try that :)
0
lucasnoob Posted messages 71 Status Membre 1
 
Oh yeah!!!! It will be time, I tested it and it works.
0
denstieven Posted messages 717 Status Membre 42
 
Thank you for your reply boly38, I have already seen this command, but it only works under Vista :'(
0
lucasnoob Posted messages 71 Status Membre 1
 
xD !!
0
denstieven Posted messages 717 Status Membre 42
 
Not bad boly38, I found this, but we need something that will refresh the echo

@ECHO OFF
set /a nomjou=10
echo Wait %nomjou% seconds
:loop
set /a nomjou = nomjou - 1
ping -n 1 127.0.0.0 > NUL
if %nomjou%==0 goto endloop
goto loop
:endloop
ECHO END
pause

If you found something incorrect in my batch, let me know (I’m a beginner :D)
0
denstieven Posted messages 717 Status Membre 42
 
Don't ask me why the variable is called 'nomjou' :p
0