Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Getting User Input From a Script
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Clay Calvert  
View profile  
 More options Nov 7 2001, 6:40 pm
Newsgroups: alt.msdos.batch.nt
From: Clay Calvert <ccalv...@WanGuru.com>
Date: Wed, 07 Nov 2001 18:42:07 -0500
Local: Wed, Nov 7 2001 6:42 pm
Subject: Re: Getting User Input From a Script

Frank:

Walter Zackery did the same in August 99, but good job figuring it out
on your own.

http://home7.inet.tele.dk/batfiles/main/ntscript.htm

Thanks

By the way, has anyone seen this technique for a simple SLEEP routine
on machines that have TCP/IP installed (which is probably 99.9%, by
now).

ping -n 10 127.0.0.1>nul

Replace the "10" with number of seconds you want, but add one to it.
So, the above would SLEEP for 9 seconds.

Here is why it works; PING, by default, waits one second for each
reply, and will wait that entire second even if it gets a reply in
just a few milliseconds.  The exception to this is the very last
packet.  As soon as PING receives the last packet sent, it will stop.
Since the local loopback is being PINGed, in this example, the reply
is nearly instaneous.  Probably only one millisecond.

What's funny is that the "-n" parameter can be set up to 2^32, which
is somewhere over 138 years.  ; )

Thanks again,

On Wed, 07 Nov 2001 21:45:16 GMT, "Frank"

<vmivbkr...@ryfqyrhenumkktks.com> wrote:
>I just came up with a procedure for getting user input that I don't think
>I've seen before, but it's so simple that it must be in use somewhere. The
>procedure uses the commands VOL and LABEL, the first to get the label of
>the current drive and to restore it later, and the second to get user
>input. Input is terminated by pressing [ENTER]. Here's the simplest form:

>::::::::::::::::::::::::::::::::::::::::::::::::::
>Echo Input:
>For /F "tokens=6" %%a in ('Vol') Do Set Label=%%a
>Label>NUL: 2>&1
>For /F "tokens=6" %%a in ('Vol') Do Set Input=%%a
>Label %Label%
>::::::::::::::::::::::::::::::::::::::::::::::::::

>At this point the variable %Input% contains any input. One side effect of
>this procedure is that if the user presses enter without any other input,
>LABEL moves on to a second prompt which asks if the user wants to delete
>the current label or not. The user can't see this prompt though because
>it's redirected to NUL:. So the script should also echo instructions for
>canceling, something like:

>  Echo Enter your name (or CTRL-Z to cancel):

>This procedure changes and restores the label of the current drive so if
>you aren't comfortable with that you can specify the drive:

>::::::::::::::::::::::::::::::::::::::::::::::::::
>Set Drive=A:
>Echo Input (or CTRL-Z to cancel):
>For /F "tokens=6" %%a in ('Vol %Drive%') Do Set Label=%%a
>Label %Drive%>NUL: 2>&1
>For /F "tokens=6" %%a in ('Vol %Drive%') Do Set Input=%%a
>Label %Drive% %Label%
>::::::::::::::::::::::::::::::::::::::::::::::::::

>Frank

Clay Calvert
Replace "W" with "L" in email.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.