Home / Microsoft / Microsoft DOS / making batch file wait
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: making batch file wait  (Read 791 times)
dakota
Guest
« on: May 09, 2006, 06:45:07 PM »

how do i make a batch file wait for 5sec befor it exits
IP logged
almn
Guest
« Reply #1 on: May 09, 2006, 07:58:26 PM »

Its very complicated  ;D
you have to create a batch named wait.bat in the windows folder,in that batch type :
@CHOICE /T:N,%1% >  NUL
than when you want to wait you just type :
wait and the number of seconds you want to wait

Hope it helps

Almn
IP logged
dakota
Guest
« Reply #2 on: May 09, 2006, 08:01:02 PM »

i have a bat file that dose its thing and says Done!!!! when it is done
but i want done to display for 5sec and the the program would end :)
« Last Edit: May 09, 2006, 09:32:26 PM by dakota » IP logged
almn
Guest
« Reply #3 on: May 09, 2006, 08:07:04 PM »

than put it after "echo done"  :)

Almn
IP logged
dakota
Guest
« Reply #4 on: May 09, 2006, 10:50:54 PM »

does not work
IP logged
uli_glueck
Guest
« Reply #5 on: May 10, 2006, 12:16:19 AM »

There is a workaround with the ping command. It was posted a few month before.

Otherwise use the sleep command from the ressource kit.

sleep 5

hope this helps
uli
« Last Edit: May 10, 2006, 02:55:01 AM by uli_glueck » IP logged
dakota
Guest
« Reply #6 on: May 10, 2006, 01:02:57 AM »

here is somthing i made
Code: [Select]
@echo off
set count1=0

:loop
@cls
echo Working.
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "500" (
goto :dot
) ELSE (
goto :loop
)
:dot
@cls
echo Working..
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "1000" (
goto :dot2
) ELSE (
goto :dot
)
:dot2
@cls
echo Working...
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "1500" (
goto :part2
) ELSE (
goto :dot2
)
:part2
:loop2
@cls
echo Done!!!
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "3000" (
goto :end
) ELSE (
goto :loop2
)
:end

IP logged
ghostdog74
Mentor



Thanked: 26
Posts: 1,511


« Reply #7 on: May 10, 2006, 01:57:21 AM »

this is not a batch solution..
just that sometimes, its much easier to program with a better scripting language than batch.

#python example
import time
do_something()
time.sleep(5) #sleep 5 secs
do_anotherthing()

IP logged

dakota
Guest
« Reply #8 on: May 10, 2006, 04:38:57 PM »

Code: [Select]
@echo off
set count1=0
echo Done!!!
:loop
set/a count1=count1+1
IF "%count1%" EQU "1000" (
goto :end
) ELSE (
goto :loop
)
:end
this does the trick ;D ;D
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / making batch file wait « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.098 seconds with 22 queries.