Computer Hope

Microsoft => Microsoft DOS => Topic started by: Xenfire on April 29, 2009, 06:38:10 PM

Title: User Input Time Limit
Post by: Xenfire on April 29, 2009, 06:38:10 PM
Is there a possible way to ask for user input, but if they take too long to input, the script would continue?

Example

@echo off
echo Enter something here.
set /p a=
(if 3 seconds pass and nothing has been written, continue with script)
*commands*


Help?
Title: Re: User Input Time Limit
Post by: Helpmeh on April 29, 2009, 06:43:35 PM
Is there a possible way to ask for user input, but if they take too long to input, the script would continue?

Example

@echo off
echo Enter something here.
set /p a=
(if 3 seconds pass and nothing has been written, continue with script)
*commands*


Help?

Choice.exe can acomplish ths Jakob. (Download from CH Downloads section)

Edit: Although every computer that the batch script will be on must have choice.exe (or .com) on it.
Title: Re: User Input Time Limit
Post by: Xenfire on April 29, 2009, 09:42:36 PM
*censored* you

what would I write.
Title: Re: User Input Time Limit
Post by: macdad- on April 30, 2009, 11:24:35 AM
This may clear it up:

Code: [Select]
@echo off
:main
choice /C:YN /T:N,3 Would you like to enter something
if ERRORLEVEL 2 goto entercmd
<your commands here>
goto end

:entercmd
set /p input=Enter something:
goto main

:end
exit

That help?

Title: Re: User Input Time Limit
Post by: Xenfire on April 30, 2009, 03:14:16 PM
This may clear it up:

Code: [Select]
@echo off
:main
choice /C:YN /T:N,3 Would you like to enter something
if ERRORLEVEL 2 goto entercmd
<your commands here>
goto end

:entercmd
set /p input=Enter something:
goto main

:end
exit

That help?


Yes, thank you.
Title: Re: User Input Time Limit
Post by: Helpmeh on May 02, 2009, 04:31:35 PM
Yes, thank you.
If you are planning to use that where I think you will want to use that, you need to know that choice.exe (or .com) must be included with the script, because where I think you want to use it does not have choice.exe or choice.com .
Title: Re: User Input Time Limit
Post by: macdad- on May 02, 2009, 04:48:26 PM
Very true, Helpmeh.

Xenfire for an NT version(Win2K, XP, and Vista) of Choice use this:Link (http://ftp://ftp.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/SCRPTING/CHOICE.EXE)
If you have an OS older than Win2K, then CHOICE.COM is probably on there already.
Title: Re: User Input Time Limit
Post by: Helpmeh on May 02, 2009, 04:52:19 PM
Very true, Helpmeh.

Xenfire for an NT version(Win2K, XP, and Vista) of Choice use this:Link (http://ftp://ftp.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/SCRPTING/CHOICE.EXE)
If you have an OS older than Win2K, then CHOICE.COM is probably on there already.
The OS for what I'm about 99% sure he's thinking of putting it on is XP Pro. Although there is like a 0.0001% chance that the Admins put it on...even though that would be completely stupid...
Title: Re: User Input Time Limit
Post by: macdad- on May 02, 2009, 04:56:23 PM
Yea, and if he had Windows 2003 he wouldn't need to download it, it comes with it.
Title: Re: User Input Time Limit
Post by: Helpmeh on May 02, 2009, 05:02:52 PM
Yea, and if he had Windows 2003 he wouldn't need to download it, it comes with it.
I'm not sure what OS he has at home...but what I'm fairly sure he will be doing with it will not be used at home...
Title: Re: User Input Time Limit
Post by: macdad- on May 03, 2009, 11:38:36 AM
True, Windows 2003 is more or less used as a Server OS, not really intended as a Home OS.
Title: Re: User Input Time Limit
Post by: Helpmeh on May 03, 2009, 01:15:05 PM
Just looked, he has WIN XP (so does where the script will probably be put into affect)...so choice must be included...
Title: Re: User Input Time Limit
Post by: macdad- on May 03, 2009, 04:43:39 PM
Not necessarily, I have Win XP Pro and choice isn't on mine.

 
Title: Re: User Input Time Limit
Post by: Helpmeh on May 10, 2009, 10:50:41 AM
Not necessarily, I have Win XP Pro and choice isn't on mine.

 
Choice must be INCLUDED...as in with the script package.
Title: Re: User Input Time Limit
Post by: macdad- on May 10, 2009, 03:02:53 PM
What service pack do you have?

I have SP3
Title: Re: User Input Time Limit
Post by: Helpmeh on May 10, 2009, 03:06:05 PM
What service pack do you have?

I have SP3
SP2...I can't get SP3
Title: Re: User Input Time Limit
Post by: macdad- on May 10, 2009, 03:14:18 PM
Interesting...wonder why they cut out Choice in SP3....

Oh well.
Title: Re: User Input Time Limit
Post by: Helpmeh on May 10, 2009, 03:22:07 PM
Interesting...wonder why they cut out Choice in SP3....

Oh well.
It's not in SP2.