::::::::::::::::::::::::::::::::::::::::::::::::::
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
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,
Clay Calvert
Replace "W" with "L" in email.