how to make a times resoponce or the comp...

August 27, 2010 at 12:21:15
Specs: Windows 7
well im wanting to make a script that has a timed response example
u have 5 secs to type: naruto7
and if they type it correctly it just echos a responts
and if they type it wrong or don't type anything it shuts down their comp (they can keep guessing till they get it right but after their time is up it shuts down the comp)
im assuming that when they get it correct it will to it to do a goto script to got to the message and the same for when they get it wrong it will do a goto scrip to take it to what the directions for the shutdown command

See More: how to make a times resoponce or the comp...

Report •

#1
August 28, 2010 at 21:08:48
When I fist glanced over this, I didn't really know what you wanted. But I thought about it, and...

Try this:

@ECHO OFF

:Start

SET Timeout=TIME TO WAIT
SET Sec1=%Time:~6,2%
SET /a TSec=%Sec%+%Timeout%
IF "%TSec%" GTR "60" GOTO Start

:Start2

CLS
SET Sec2=%Time:~6,2%
ECHO Enter the password:
SET /p Variable=""
IF "%Sec2%" GEQ "%TSec%" GOTO Timeout
IF "%Sec2%" LSS "%Sec%" GOTO Timeout
IF "%Variable%"=="somethingelse" GOTO Next
GOTO Start2

:Next

CLS
ECHO Success!
ECHO.
PAUSE
EXIT

:Timeout

CLS
ECHO SHUTDOWN /f
PAUSE >Nul
EXIT

This will work, as long as your wait is less than 60. It goes into the loop to avoid the timeout from going above 60 seconds. So... the larger the number the longer it will take to set-up (up to a minute).

If you want it to go into minutes you will have to tweak it a little bit.


Report •

#2
August 30, 2010 at 12:50:43
quick question where is the pass that they have to enter and what part do i change for the time
and can i get a thing for where they have 3 chances to get it correct or it goes to the timeout tab
so basically im asking for a time limit and 3 chances to get it correct
and where the word that makes it go to next because i tried "somethingelse" and it still takes me to the timeout tab

Report •

#3
August 30, 2010 at 13:39:33
@ECHO OFF

:Start

SET Number=1
SET Timeout=TIMEOUT
SET Sec1=%Time:~6,2%
SET /a TSec=%Sec%+%Timeout%
IF "%TSec%" GTR "60" GOTO Start

:Start2

CLS
SET Sec2=%Time:~6,2%
ECHO Enter the password:
SET /p Variable=""
IF "%Sec2%" GEQ "%TSec%" GOTO Timeout
IF "%Sec2%" LSS "%Sec%" GOTO Timeout
IF "%Variable%"=="PASSWORD" GOTO Next
IF "%Number%"=="3" GOTO Timeout
SET /a Number+=1
GOTO Start2

:Next

CLS
ECHO Success!
ECHO.
PAUSE
EXIT

:Timeout

CLS
ECHO SHUTDOWN /f
PAUSE >Nul
EXIT

----

There you go. The bolded portion is what you change


Report •

Related Solutions

#4
August 30, 2010 at 18:58:16
@ECHO OFF

:Start

SET Number=1
SET Timeout=100
SET Sec1=%Time:~6,2%
SET /a TSec=%Sec%+%Timeout%
IF "%TSec%" GTR "60" GOTO Start

:Start2

CLS
SET Sec2=%Time:~6,2%
ECHO Enter the password:
SET /p Variable=""
IF "%Sec2%" GEQ "%TSec%" GOTO Timeout
IF "%Sec2%" LSS "%Sec%" GOTO Timeout
IF "%Number%"=="3" GOTO Timeout
SET /a Number+=1
IF "%Variable%"=="test" GOTO Next


GOTO Start2

:Next

CLS
ECHO Success!
ECHO.
PAUSE
EXIT

:Timeout

CLS
ECHO SHUTDOWN /f
PAUSE >Nul
EXIT
i tryed this and got it working but when i make the timer over 60 it jumps right to the timeout tab


Report •

#5
August 30, 2010 at 19:12:05
It uses you're current time (In seconds) and as that only goes up to 60 it won't work when you go above.

Can I put a question here?


Report •

#6
August 30, 2010 at 19:38:35
k i was just wondering
btw i want to add a timer but all the timer scripts i make i seem to not be able to get it to count down in secs only millisecond for some reason so i was wondering if u can make me a quick countdown that i can edit with houre's min's and sec's even if it dont use all of them in the timer that i set on it
for examle i was this timer to count down 1 hour
1:00:00 --> 0:59:59 ect...
or i want this timer to count down 50hours
50:00:00 --> 49:59:59 ect...

Report •

#7
August 31, 2010 at 06:27:54
This will work on vista and windows 7. If you have an earlier version than that, replace "TIMEOUT /t 1" with "PING 127.0.0.1 /n 2". The TIMEOUT command is much more stable though.

@ECHO OFF

:Setup

SET /p Hours=Hours:
SET /p Minutes=Minutes:
SET /p Seconds=Seconds:

:Countdown

CLS
ECHO %Hours%:%Minutes%:%Seconds%

TIMEOUT /t 1 >Nul

IF "%Seconds%"=="0" (
	IF "%Minutes%"=="0" (
		IF "%Hours%"=="0" (
			GOTO Done
		)
		SET /a Hours -=1
		SET Minutes=60
	)
	SET /a Minutes -=1
	SET Seconds=60
)

SET /a Seconds -=1
GOTO Countdown

:Done

CLS
ECHO Times Up!
ECHO.
PAUSE

Can I put a question here?


Report •

#8
September 1, 2010 at 03:41:50
yess u can put a question hear...
^^ the script works but what do i change to set it where i just edit the script for example i run 1 think and i have it call the timer and the timer is telling u how much time u have left to complete so and so
example i want timer to run for 1 hour script calls it and it starts counting down the 1 hour right when it opens.

Report •

#9
September 1, 2010 at 03:45:19
Oh, Change the "SET /p"s to just SET, followed by the amount of time you want.

Can I put a question here?


Report •

#10
September 1, 2010 at 13:36:33
why do i keep seeing a " Can I put a question here? " at the bottom of each of your posts?

Report •

#11
September 1, 2010 at 13:39:40
It's my signature. When you go to add one, it says "DO NOT PUT A QUESTION HERE!' so, I put one.

Can I put a question here?


Report •

Ask Question