Society of Robots - Robot Forum

Software => Software => Topic started by: cooldog on February 26, 2008, 09:07:07 PM

Title: question on .bat code
Post by: cooldog on February 26, 2008, 09:07:07 PM
okay so i wrote this fun little code for my computer

Quote
@echo off
cls
pause
cls
echo why did the chicken cross the road...?
color 0a
pause
cls
echo any suggestions...
color 0a
pause
cls
echo to get to the other side
color 0a
pause
cls
:loop
echo hahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
color 0a
goto loop


just something fun

you see how it has pause written in it, that Makes it stop until i push a button... so is there anyway to make it pause for a certain time like 3 seconds then continue
Title: Re: question on .bat code
Post by: ed1380 on February 26, 2008, 10:19:20 PM
delay? cycles, times, etc
Title: Re: question on .bat code
Post by: HDL_CinC_Dragon on February 26, 2008, 11:14:03 PM
no theres no built in method for it.
look here: http://www.computerhope.com/batch.htm
Title: Re: question on .bat code
Post by: HDL_CinC_Dragon on February 26, 2008, 11:20:56 PM
You also dont have to do the "color 0a" more than once in the code. Once its there, its there.
add this under @echo off: "Title Really good joke" minus the quotes
Title: Re: question on .bat code
Post by: cooldog on February 27, 2008, 05:58:18 AM
Quote
ping 127.0.0.1 -n 2

i found this at
http://www.robvanderwoude.com/wait.html

it works okay for a delay but when it is delaying it shows up on screen it doesn't stay hidden any ideas
Title: Re: question on .bat code
Post by: izua on February 27, 2008, 06:05:04 AM
try "pause". it will wait for a keystroke.
Title: Re: question on .bat code
Post by: cooldog on February 27, 2008, 07:12:14 AM
you see how it has pause written in it, that Makes it stop until i push a button... so is there anyway to make it pause for a certain time like 3 seconds then continue
Title: Re: question on .bat code
Post by: izua on February 27, 2008, 11:15:35 AM
hmm, right.
Well, if you want, I can make you a little C++ program that you can run from your batch list, and you'll pass it an argument in ms - the delay.
it will look something like this:
Code: [Select]
holdon 400
echo something
holdon 2500
echo something else
Title: Re: question on .bat code
Post by: HDL_CinC_Dragon on February 27, 2008, 05:52:53 PM
Second file under "DOS"
http://www.computerhope.com/dutil.htm
Title: Re: question on .bat code
Post by: cooldog on February 27, 2008, 07:06:44 PM
okay so i loaded it... but can't get it to work

instead of pause i tryed
sleep 20
sleep.exe 20
sleep20

but non of them work
Title: Re: question on .bat code
Post by: paulstreats on February 27, 2008, 07:16:34 PM
did you try pointing to the absolute path

c:\mydocs\mybats\sleep.exe 20

Also try running it from a command prompt directly to see if it works and any error codes, You can also try querying it this way too       sleep.exe /? usually brings up instructions if they have been programmed accordingly. Also it may be the case that if you are using xp/vista then it just might not work for you