Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Attn: Laura Fairhead or someone else who can explain this, please

15 views
Skip to first unread message

Outsider

unread,
Dec 8, 2001, 4:24:51 AM12/8/01
to
:READDATE
FOR %%_ IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 1%%_ SET DATE=%DATE%%%_
CHOICE /C&&&&&&&&&0123456789>NUL
IF ERRORLEVEL 10 GOTO READDATE
ECHO SET DATE=%DATE%


I am trying to get this to work to parse the %date% variable which contains
the date, but how is choice supposed to get it's input?

--
<!-Outsider//->
MS-DOS 6.22, Windows for Workgroups 3.11, Netscape Communicator 4.08

William Allen

unread,
Dec 8, 2001, 5:35:29 AM12/8/01
to
"Outsider" wrote in message

> :READDATE
> FOR %%_ IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 1%%_ SET DATE=%DATE%%%_
> CHOICE /C&&&&&&&&&0123456789>NUL
> IF ERRORLEVEL 10 GOTO READDATE
> ECHO SET DATE=%DATE%
>
>
> I am trying to get this to work to parse the %date% variable which contains
> the date, but how is choice supposed to get it's input?

A fully documented diagnostic version of this CHOICE
streaming technique for parsing was posted by the team
here as thread:
Subject: More date and time elements
Date: Sun, 14 Oct 2001 14:05:58 +0100
and diagnostic follow-up: Date: Sun, 14 Oct 2001 20:39:19 +0100

Since a small number of posts are not captured by Google,
and this may be one, here is a slightly edited repeat of those
two posts:

========Repeat post 1:

This idea is really just tossed in for anyone interested to play with.
I don't consider it a finished script as it stands.

It uses the techniques of ExitPrompt and streaming-ChoiceParsing
recently discovered in amb. Also uses BennyLevel errorlevel checking.

The general idea is to pipe the Date and Time from the PROMPT
command through CHOICE, and trap any Bell characters output.

A Bell character (ASCII 007) is output by CHOICE whenever the
reply to the command is not in the /c: switch list, and this BELL
character can be redirected to a file.

The trap result used to replace non-numerics with [Space]s. Used this
way, CHOICE can parse / characters. So this script should handle
all the various time and date separators used in different Locales.

It gets the day month year elements in _your_ system date order
in D1 D2 and D3 and the hour minute second and hundreth of
a second elements in HR MM SS S1 variables. Works here in
Windows 95 and MS-DOS 6.22. Could do with a less kludgey
way of trapping ASCII 007s.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)

SET D1=
ECHO.@PROMPT e0'SET B='7 d a$_rcx$_9$_w0$_q>%TEMP%.\TM.BAT
%COMSPEC% /e:4096 /c %TEMP%.\TM.BAT | debug %TEMP%.\TM.BAT>NUL
CALL %TEMP%.\TM.BAT

ECHO.EXIT|%COMSPEC%/e:4096/k PROMPT SET V=$d $t$_:>%TEMP%.\TM.BAT
CALL %TEMP%.\TM.BAT

ECHO.%V%&|%COMSPEC%/e:4096/c %0 GOTO: _PARSE>%TEMP%.\TM.BAT
FOR %%C IN (CALL DEL) DO %%C %TEMP%.\TM.BAT

:: Set all the different elements from the single spaced-out variable D1
ECHO.SET D1=%%1>%TEMP%.\TM.BAT
ECHO.SET D2=%%2>>%TEMP%.\TM.BAT
ECHO.SET D3=%%3>>%TEMP%.\TM.BAT
ECHO.SET HR=%%4>>%TEMP%.\TM.BAT
ECHO.SET MM=%%5>>%TEMP%.\TM.BAT
ECHO.SET SS=%%6>>%TEMP%.\TM.BAT
ECHO.SET S1=%%7>>%TEMP%.\TM.BAT
CALL %TEMP%.\TM.BAT %D1%
FOR %%F IN (TM.BAT TRAP) DO DEL %TEMP%.\%%F

ECHO. Note that D1 D2 and D3 are in your system date order
ECHO. D1=%D1% D2=%D2% D3=%D3% HR=%HR% MM=%MM% SS=%SS% S/100=%S1%

FOR %%V IN (V V1 B D1 D2 D3 HR MM SS S1) DO SET %%V=

GOTO EOF (=Subroutine code follows=)
:_PARSE (Usage: CALL %0 GOTO: _PARSE +input redirect date/time)
FOR %%V IN (V1 V) DO SET %%V=
CHOICE /C&0123456789 /n>%TEMP%.\TRAP
FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N
IF ERRORLEVEL 2 SET V1=GOTO _PARSE
FIND "%B%"<%TEMP%.\TRAP>NUL
IF ERRORLEVEL 1 SET D1=%D1%%V%
IF NOT ERRORLEVEL 1 SET D1=%D1% %V%
%V1%
ECHO.SET D1=%D1%
EXIT

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines
that don't begin with two spaces have wrapped in transmission. The
code was created and tested in Win9x GUI and MS-DOS 6.22

========End Repeat post 1

========Repeat post 2:

This post is merely for anyone interested in learning how this form
of ChoiceParsing works, it adds nothing to the working script
(but see Note 1 regarding redundant EXIT in working script).

This type of script is quite hard to follow, even for moderately
experienced Batch file authors That's because usual the normal
tracing techniques in the key section (the _PARSE routine):
turning ECHO ON,
inserting PAUSEs,
inserting ECHO messages
even running in a command/y/c debug mode shell
are all more-or-less useless.

The operation of the key part of the script, the _PARSE subroutine
_depends_ on ECHO being OFF, and it's run in a child shell with
output redirected to a transient Batch file. So a normal added ECHO
isn't seen, but instead generates a "bad command" error later when
the transient script is run.

What's more, a string of characters is piped into this child shell
(the date and time material from PROMPT) so any PAUSE command
inserted there immediately resumes instead of prompting for a key
entry in the normal way.

For those interested in how it works, this version inserts diagnostic
ECHO commands and delays in the correct places. You should compare
it with the original to see where they're inserted. Some relevant ECHOs
need redirection to CON so that they are seen instead of interfering with
operation of the transient script.

This 2-second delay as each character is parsed is so that you can
track the action more easily. Alter the delay time where shown for
delays from 1 - 99 seconds.

Again, what's happening is that a string looking like (Locale dependent):
Sun 14/10/2001 20:32:41.02&
(with the & added as a terminator) is piped through a child shell running
CHOICE to pick out numerics (and the terminator) with /c:&0123456789.
When a non-numeric hits this CHOICE command it outputs a BELL
(ASCII 7) character which is detected and used as a flag to insert a
[Space] in the character stream being parsed, so it's broken into the
separate date and time elements.

Just run the demo and follow the action on screen.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)

SET D1=
ECHO.@PROMPT e0'SET B='7 d a$_rcx$_9$_w0$_q>%TEMP%.\TM.BAT
%COMSPEC% /e:4096 /c %TEMP%.\TM.BAT | debug %TEMP%.\TM.BAT>NUL
CALL %TEMP%.\TM.BAT

ECHO.EXIT|%COMSPEC%/e:4096/k PROMPT SET V=$d $t$_:>%TEMP%.\TM.BAT
CALL %TEMP%.\TM.BAT

:: Clear the screen
CLS
ECHO. Parsing %V%& (the & is a terminator)

ECHO.%V%&|%COMSPEC%/e:4096/c %0 GOTO: _PARSE>%TEMP%.\TM.BAT
FOR %%C IN (CALL DEL) DO %%C %TEMP%.\TM.BAT

:: Set all the different elements from the single spaced-out variable D1
ECHO.SET D1=%%1>%TEMP%.\TM.BAT
ECHO.SET D2=%%2>>%TEMP%.\TM.BAT
ECHO.SET D3=%%3>>%TEMP%.\TM.BAT
ECHO.SET HR=%%4>>%TEMP%.\TM.BAT
ECHO.SET MM=%%5>>%TEMP%.\TM.BAT
ECHO.SET SS=%%6>>%TEMP%.\TM.BAT
ECHO.SET S1=%%7>>%TEMP%.\TM.BAT
CALL %TEMP%.\TM.BAT %D1%
FOR %%F IN (TM.BAT TRAP) DO DEL %TEMP%.\%%F

ECHO. Note that D1 D2 and D3 are in your system date order
ECHO. D1=%D1% D2=%D2% D3=%D3% HR=%HR% MM=%MM% SS=%SS% S/100=%S1%

FOR %%V IN (V V1 B D1 D2 D3 HR MM SS S1) DO SET %%V=

GOTO EOF (=Subroutine code follows=)
:_PARSE (Usage: CALL %0 GOTO: _PARSE +input redirect date/time)
FOR %%V IN (V1 V) DO SET %%V=
choice /c:&0123456789 /n>%TEMP%.\TRAP
FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N
IF ERRORLEVEL 2 SET V1=GOTO _PARSE
find "%B%"<%TEMP%.\TRAP>NUL
IF ERRORLEVEL 1 SET D1=%D1%%V%
IF NOT ERRORLEVEL 1 SET D1=%D1% %V%
IF NOT ERRORLEVEL 1 ECHO. Char(s) not on /c: list (trapped a BELL)>CON
IF (%V%)==() ECHO. Found the & terminator>CON
IF NOT (%V%)==() ECHO. Found a %V%>CON
:: 2-second Diagnostic delay here, increase the time if you wish
REM | choice /c:delay /td,2>NUL
%V1%
ECHO.SET D1=%D1%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines
that don't begin with two spaces have wrapped in transmission. The
code was created and tested in Win9x GUI.

Note: The original code had a redundant EXIT left in from
developing the code.
WA> %V1%
WA> ECHO.SET D1=%D1%
WA> EXIT
WA>
WA> :EOF (End-of-file)

That EXIT can be removed (and is removed in the above).

========End Repeat post 2:

--
(pp) William Allen

Note 1:
Benny Pedersen's ExitPrompt idea explained in:
From: "William Allen"
Newsgroups: alt.msdos.batch
Subject: ECHOing custom prompt messages [LONG]
Date: Sun, 7 Oct 2001 11:01:23 +0100
Message-ID: <9pp97l$jfrjf$1...@ID-55970.news.dfncis.de>

Note 2:
Laura Fairhead's ChoiceParsing, see:
From: (laura fairhead)
Newsgroups: alt.msdos.batch
Subject: Re: Zipping a file file into a new file named as todays date
Date: Wed, 03 Oct 2001 19:33:02 GMT
Message-ID: <3bbb67ed...@news.cis.dfn.de>

Note 3:
Explanation of the arithemtic of BennyLevel checking
From: "William Allen"
Newsgroups: alt.msdos.batch
Subject: BennyLevel ERRORLEVEL arithmetic (was Re: VOL and...
Date: Mon, 20 Nov 2000 02:38:58 -0000
Message-ID: <8v9n3j$3fjv1$1...@ID-55970.news.dfncis.de>


William Allen

unread,
Dec 8, 2001, 5:44:30 AM12/8/01
to
"William Allen" wrote in message
...snip

> A fully documented diagnostic version of this CHOICE
> streaming technique for parsing

The following demo of the same CHOICE streaming parser
was posted yesterday in thread: Re: %time%...DOS vs. Win98

======Repost:

The following script uses CHOICE to strip all non-numerics
from a string. So the time in, say format: 16:41:57.70 is
reduced to 16415770 which is a suitable string for a filename.

NOTE that the REN line is inactivated by ECHO.{demo!}
which you MUST remove to activate. Relocate the TEMP.BAT
workfile to your TEMP folder if you wish.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)

SET TIME=
ECHO.EXIT|%COMSPEC%/k PROMPT $t&|%COMSPEC%/c %0 GOTO: _TM>TEMP.BAT
FOR %%C IN (CALL DEL) DO %%C TEMP.BAT
ECHO.{demo!}REN g:\12345.ldq %TIME%.qyg
SET TIME=

GOTO EOF (=Subroutine code follows=)

:_TM
CHOICE /C&0123456789 /n>NUL


FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N

IF ERRORLEVEL 2 SET TIME=%TIME%%V%
IF ERRORLEVEL 2 GOTO _TM
ECHO.SET TIME=%TIME%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines
that don't begin with two spaces have wrapped in transmission.

--
(pp) William Allen


Message has been deleted

William Allen

unread,
Dec 8, 2001, 8:54:07 AM12/8/01
to
"Outsider" wrote in message
...snip
> I have been trying to understand these models, but I am
> having a hard time breaking them down into an easily understood format,
> so I have been unable to learn the techniques imbedded inside.

The general idea of the CHOICE streaming parser is to pipe
a character stream directly into a child COMMAND.COM
shell executing the Batch script. The recall in the child shell
calls the CHOICE parsing subroutine. The characters piped
into the child shell are processed by CHOICE and any _NOT_
in the valid CHOICE list are tranlated to Bell characters (which
can be checked if desired), and CHOICE reads further until
it finds a valid reply list character. So if the valid reply list
consists ONLY of numerices, CHOICE effectively removes
non numerics from the stream.

The main difference between this streaming method and the
usual CHOICE parsing is that the streaming method can
process (and remove) characters such as forward slash [/]

Because the stream is parsed in a child shell, any variables
set in the child shell are lost. Therefore a line:
SET VAR=%VAR%
is ECHOed in the child shell and captured in TEMP.BAT
for execution once the script has returned from the child
shell.

As previously explained in the full documentation post,
this means that normal debugging techniques (command /y
and ECHO ON) can't be used to track what is happening.

These two pure demo scripts show how to patch in diagnostic
ECHO commands (which MUST be redirected to CON to
be seen - otherwise they'll interfere with the script action).

These ECHO commands should make clear what is happening.

This first demo merely ECHOs a mixed alpha and numeric
string into the parser and ECHOs the variable states as the
Subroutine catches the character stream.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)
SET TIME=

ECHO.Some 1 2 3 Numerics 4 5 6 in string&|%COMSPEC%/c %0 GOTO: _TM>TEMP.BAT


FOR %%C IN (CALL DEL) DO %%C TEMP.BAT

SET TIME=

GOTO EOF (=Subroutine code follows=)
:_TM
CHOICE /C&0123456789 /n>NUL
FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N
IF ERRORLEVEL 2 SET TIME=%TIME%%V%

:: These lines are purely for demo purposes
ECHO. Variable V captured character [%V%]>CON
ECHO. Variable TIME is now %TIME%>CON

IF ERRORLEVEL 2 GOTO _TM
ECHO.SET TIME=%TIME%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines

that don't begin with two spaces have wrapped in transmission. The
Batch code above was written and tested in the Win9x GUI.

Notes:
1) The & is a terminator character so the Subroutine can finish
when the character stream ends. Without the terminator, which
should occupy the low position in the CHOICE reply list, the
Subroutine hangs in the child shell at CHOICE.

2) The BennyLevel 77 prefix merely shifts the captured ERRORLEVEL
by CHOICE from range 1-10 to range 0-9.

This version captures the date from PROMPT and parses
it in the same way.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)
SET TIME=

ECHO.EXIT|%COMSPEC%/e:4096/k PROMPT $d&|%COMSPEC%/c %0 GOTO: _TM>TEMP.BAT


FOR %%C IN (CALL DEL) DO %%C TEMP.BAT

SET TIME=

GOTO EOF (=Subroutine code follows=)
:_TM
CHOICE /C&0123456789 /n>NUL
FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N
IF ERRORLEVEL 2 SET TIME=%TIME%%V%

:: These lines are purely for demo purposes
ECHO. Variable V captured character [%V%]>CON
ECHO. Variable TIME is now %TIME%>CON
:: End lines purely for demo purposes

IF ERRORLEVEL 2 GOTO _TM
ECHO.SET TIME=%TIME%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines

that don't begin with two spaces have wrapped in transmission. The
Batch code above was written and tested in the Win9x GUI.

--
(pp) William Allen


William Allen

unread,
Dec 8, 2001, 9:21:20 AM12/8/01
to
"William Allen" wrote in message
...snip
> 2) The BennyLevel 77 prefix merely shifts the captured ERRORLEVEL
> by CHOICE from range 1-10 to range 0-9.

For anyone who finds BennyLevel hard to follow, this version
of the diagnostic script avoids using it. A reference to full
details of using BennyLevel is shown below.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)
SET TIME=
ECHO.EXIT|%COMSPEC%/e:4096/k PROMPT $d&|%COMSPEC%/c %0 GOTO: _TM>TEMP.BAT
FOR %%C IN (CALL DEL) DO %%C TEMP.BAT
SET TIME=

GOTO EOF (=Subroutine code follows=)
:_TM

CHOICE /C&&&&&&&&&0123456789 /n>NUL
FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 1%%N SET V=%%N
IF ERRORLEVEL 10 SET TIME=%TIME%%V%

:: These lines are purely for demo purposes
ECHO. Variable V captured character [%V%]>CON
ECHO. Variable TIME is now %TIME%>CON
:: End lines purely for demo purposes

IF ERRORLEVEL 10 GOTO _TM
ECHO.SET TIME=%TIME%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines
that don't begin with two spaces have wrapped in transmission. The
Batch code above was written and tested in the Win9x GUI.

The variable TIME captures whatever numerics are streamed
into the Subroutine, omitting any non-numerics.

--
(pp) William Allen

Reference: BennyLevel Arithmetic explained in detail
http://groups.google.com/groups?as_umsgid=8va2r4$3vd2a$1...@ID-55970.news.dfncis.de


Message has been deleted

William Allen

unread,
Dec 9, 2001, 2:18:32 AM12/9/01
to
"William Allen" wrote in message
...snip
> The general idea of the CHOICE streaming parser is to pipe
> a character stream directly into a child COMMAND.COM
> shell executing the Batch script. The recall in the child shell
> calls the CHOICE parsing subroutine. The characters piped
> into the child shell are processed by CHOICE and any _NOT_
> in the valid CHOICE list are tranlated to Bell characters (which
> can be checked if desired), and CHOICE reads further until
> it finds a valid reply list character. So if the valid reply list
> consists ONLY of numerics, CHOICE effectively removes

> non numerics from the stream.

The following scripts have diagnostic ECHO.>CON lines
to display the progress of the parse operation. These lines
are not necessary to the operation of the script.

A further example shows how the streaming method can
remove all non-numerics from the _raw_ output of the DATE
command. In the demo, it is assumed that somewhere near
the end of the raw output is an open (round bracket character
that can be found to end the parsing operation. The script
briefly checks that this is so before parsing the raw DATE
output.

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)

:: This script assumes that the DATE command on the current
:: system has a format that ends with (round brackets) and
:: an opening (round bracket is used to terminate the Subroutine.
ECHO.|DATE|find "(">NUL
IF ERRORLEVEL 1 ECHO. This won't work on your system
IF ERRORLEVEL 1 GOTO EOF

SET DATE=
:: Pipe the raw output of DATE into a child shell executing subroutine
ECHO.|DATE|%COMSPEC%/c %0 GOTO: _TM>TEMP.BAT


FOR %%C IN (CALL DEL) DO %%C TEMP.BAT

ECHO. The DATE variable is finally: %DATE%
SET DATE=

GOTO EOF (=Subroutine code follows=)
:_TM

CHOICE /C(0123456789 /n>NUL


FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N

IF ERRORLEVEL 2 SET DATE=%DATE%%V%

:: These lines are purely for demo purposes
ECHO. Variable V captured character [%V%]>CON

ECHO. Variable DATE is now %DATE%>CON


:: End lines purely for demo purposes

IF ERRORLEVEL 2 GOTO _TM

ECHO.SET DATE=%DATE%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines
that don't begin with two spaces have wrapped in transmission. The
Batch code above was written and tested in the Win9x GUI.

Without a known character, the DATE output could be written to a
file and a line with, say & appended. So this version assumes only:
1) The only numerics in the raw DATE output are date digits
2) An & character _does_not_ come before any of the digits.
(The same technique would parse the raw output of TIME)

====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 (Subroutine handler)

:: This demo merely assumes that & doesn't occur in raw DATE output
ECHO.|DATE>RAWDATE.TXT
ECHO.&>>RAWDATE.TXT

SET DATE=
:: Pipe the raw output of DATE into a child shell executing subroutine
TYPE RAWDATE.TXT|%COMSPEC%/c %0 GOTO: _TM>TEMP.BAT


FOR %%C IN (CALL DEL) DO %%C TEMP.BAT

ECHO. The DATE variable is finally: %DATE%
DEL RAWDATE.TXT
SET DATE=

GOTO EOF (=Subroutine code follows=)
:_TM
CHOICE /C&0123456789 /n>NUL
FOR %%N IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 77%%N SET V=%%N

IF ERRORLEVEL 2 SET DATE=%DATE%%V%

:: These lines are purely for demo purposes
ECHO. Variable V captured character [%V%]>CON

ECHO. Variable DATE is now %DATE%>CON


:: End lines purely for demo purposes

IF ERRORLEVEL 2 GOTO _TM

ECHO.SET DATE=%DATE%

:EOF (End-of-file)

====End cut-and-paste (omit this line)
To use the code above, cut-and-paste the text between the ==== lines
into a file with extension .BAT and base name of your choice. Lines
that don't begin with two spaces have wrapped in transmission. The
Batch code above was written and tested in the Win9x GUI.

In the above "raw DATE output" means the output of the line:

ECHO.|DATE

--
(pp) William Allen


Benny Pedersen

unread,
Dec 9, 2001, 9:19:18 AM12/9/01
to
"William Allen" <NGr...@mayfly13.fsnet.co.uk> wrote news:9usqec$arkj4$1...@ID-55970.news.dfncis.de...

> "Outsider" wrote in message
> > :READDATE
> > FOR %%_ IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 1%%_ SET DATE=%DATE%%%_
> > CHOICE /C&&&&&&&&&0123456789>NUL

..[snip]
I tried to write an answer to Outsider but I wasn't fast enough.
..[snip]

> (pp) William Allen
>
> Note 1:
> Benny Pedersen's ExitPrompt idea explained in:
> From: "William Allen"
> Newsgroups: alt.msdos.batch
> Subject: ECHOing custom prompt messages [LONG]
> Date: Sun, 7 Oct 2001 11:01:23 +0100
> Message-ID: <9pp97l$jfrjf$1...@ID-55970.news.dfncis.de>
>
> Note 2:
> Laura Fairhead's ChoiceParsing, see:
> From: (laura fairhead)
> Newsgroups: alt.msdos.batch
> Subject: Re: Zipping a file file into a new file named as todays date
> Date: Wed, 03 Oct 2001 19:33:02 GMT
> Message-ID: <3bbb67ed...@news.cis.dfn.de>
>
> Note 3:
> Explanation of the arithemtic of BennyLevel checking
> From: "William Allen"
> Newsgroups: alt.msdos.batch
> Subject: BennyLevel ERRORLEVEL arithmetic (was Re: VOL and...
> Date: Mon, 20 Nov 2000 02:38:58 -0000
> Message-ID: <8v9n3j$3fjv1$1...@ID-55970.news.dfncis.de>


Hi,

About your previours mail about that one can't find
all previours mails at the Google.

I just tried to figure out something about this topic.
So, I visited Google using one of my replys to Laura,
--Exact this, pasted:

echo. Input, (To Quit: Press Enter, then press Escape key:)
choice /n /c:All keys | find "ASCII value 7"

So, I have now searched some old messages from between august
26'th and 29'th about my replys on this subject:
ASCII value 7 character returned by Choice (detecting Enter).
Message id maybe: 3b8be9da...@news.cis.dfn.de

It seams that Google have missed my replys and I guess that
it's because that I also wrote alot of not interesting stuff
at that time, so, I really hope that Laura have made a note
because; I don't like to loose credit.

If Google also missed the Bennylevel along with the EXitPrompt
technique, then I wouldn't like Google.

Thanks to William.

Benny
BTW: Put values into environment variables is easy as:

set j=1
set P%j%=value

But what about the right side of an equal (=)

set X=value in P1

SET X=P%j% isn't possible. (X would only get the name
of the variable P1 but instead it was the value in %P1%
that we wanted).

Here's two different solutions:

@%1 echo off
SET Q1=5
SET Q2=7

::1, Could instead of "ECHO" be used with a "%COMSPEC%/cECHO" :-)
REM>~
FOR %%! in (1 2) do ECHO SET X%%!=%%Q%%!%%>> %temp%.\~.bat
CALL %temp%.\~.bat
FOR %%! IN ("SET|FIND" PAUSE CLS GOTO:EOF) DO %%! "X"
GOTO EOF

::2, Won't using an extra file:
FOR %%! in (1 2) do %COMSPEC%/c%0 GOTO:P X%%!=%%Q%%!%%>NUL
GOTO EOF
:P
::You can either delete the below @ctty nul or the above >NUL
@ctty nul
SET %2=%3
echo %X1% and %X2%>con
GOTO EOF

Benny,
PS. The Bennylevel technique have been puplished in an international
computer magazine but I can't remember the date and I can't find it
either. I guess that I have to clean up in my room. Anyhow, I have to
rent and move. I already got a letter from the landlord: move now,
execution, bailiff and etc...
i.e. my Internet conection may soon be off line.

:EOF

Outsider

unread,
Dec 9, 2001, 11:39:16 AM12/9/01
to
Benny Pedersen wrote:
>

...snipped



> Hi,
>
> About your previours mail about that one can't find
> all previours mails at the Google.

I have also experienced this missing post phenomena at Google;
there are some messages I know I (and others) posted and can't
find. Of course, it could be others have nuked their messages.

I have not checked these out, but I think some of them are free.

http://www.mailandnews.com/
http://www.newsranger.com/
http://open-news.pacbell.net/news.html
http://www.groupreader.com/
http://newsone.net/
http://news.interbulletin.com/
http://www.nuthinbutnews.com/
http://www.easyusenet.com/
http://www.news2web.com/
http://news.voila.fr/
http://www.globalnews.it/


...snipped




> @%1 echo off
> SET Q1=5
> SET Q2=7
>

...snipped

Try "test1 1" and the batch exits after outputting "echo off"

:: test1.bat
@%1 echo off
ECHO. test1

Perhaps this has some application with bailing out of a batch
if certain criteria are met by recursing with a 1 for parm one.

command/cpeculiar 1 >nul

No screen output and the batch is stopped

Or,

:: test2.bat
@SET test=echo off
@IF "%1"=="1" SET test=aborted
@%1 %test%
ECHO. test2

X:\TEMP>test2.BAT
test

X:\TEMP>test2.BAT 1
aborted

Or,

:: test3.bat
@SET test=echo off
@IF "%1"=="1" SET test=1 aborted
@%test%
ECHO. test

Or,

:: test4.bat
@SET test=echo off
@IF not "var1"=="var2" SET test=1 aborted
@%test%
ECHO. test

William Allen

unread,
Dec 9, 2001, 12:11:20 PM12/9/01
to
"Benny Pedersen" wrote in message
...snip

> About your previours mail about that one can't find
> all previours mails at the Google.
...snip

> It seams that Google have missed my replys

It can happen that Google _has_ archived a message but
their search engine fails to find it. Their search engine
appears to be faulty even when exact search criteria
are known. Even search by exact message ID can fail,
yet the message may nevertheless be archived.

======

For example, the following message was posted by the team here:

Explanation and examples of the ExitPrompt technique


From: "William Allen"
Newsgroups: alt.msdos.batch
Subject: ECHOing custom prompt messages [LONG]
Date: Sun, 7 Oct 2001 11:01:23 +0100
Message-ID: <9pp97l$jfrjf$1...@ID-55970.news.dfncis.de>

Testing at 17:06 UK local time 9-Dec-2001 from here reveals:

1)
Cut-and-paste the exact Message-ID:
9pp97l$jfrjf$1...@ID-55970.news.dfncis.de

into the Message-ID search box at:

http://groups.google.com/advanced_group_search

and search. The search fails to find any matching message.

2)
Search on exact subject+author+newsgroup at:
http://groups.google.com/advanced_group_search

using all three of:

ECHOing custom prompt messages [LONG]

William Allen
alt.msdos.batch

and search. The search fails to find any matching message.

3)
However, click on this constructed hyperlink:

Explanation/examples of the ExitPrompt technique, see post:
http://groups.google.com/groups?selm=9pp97l$jfrjf$1...@ID-55970.news.dfncis.de
Date: 7 Oct 2001

and the message is found on Google immediately, showing that
it is actually archived on Google.

--
(pp) William Allen


Outsider

unread,
Dec 9, 2001, 12:24:52 PM12/9/01
to
William Allen wrote:
>
> "Benny Pedersen" wrote in message
> ...snip
> > About your previours mail about that one can't find
> > all previours mails at the Google.
> ...snip
> > It seams that Google have missed my replys
>
> It can happen that Google _has_ archived a message but
> their search engine fails to find it. Their search engine
> appears to be faulty even when exact search criteria
> are known. Even search by exact message ID can fail,
> yet the message may nevertheless be archived.

Yes, the search facilities are pretty lame for Google groups as I have
also reported reviously in this group. I suggest people send complaints
with supporting documentation to Google.

Benny Pedersen

unread,
Dec 10, 2001, 11:03:08 AM12/10/01
to

"Outsider" <nonvali...@yahoo.com> wrote news:3C1393B4...@yahoo.com...

"test1 1" would running test1 with %1 = 1
On my system it won't exit but said Bad command or filename
as expected.

An Error message is useful when the user performs something
strange that should not be done.

Examples:
my.batch < your.bat > bios
deltree bios
call echo format all drives>anyfiles
erase anyFiles
echo BAD VIRUS > CON
ECHO Okay>user
delete user
Bad command>con
etc...

Benny,
PS. Thanks for the links.

laura fairhead

unread,
Dec 12, 2001, 1:39:23 PM12/12/01
to
On Sun, 9 Dec 2001 15:19:18 +0100, "Benny Pedersen" <b.ped...@get2net.dk> wrote:
>>
>> Note 3:
>> Explanation of the arithemtic of BennyLevel checking
>> From: "William Allen"
>> Newsgroups: alt.msdos.batch
>> Subject: BennyLevel ERRORLEVEL arithmetic (was Re: VOL and...
>> Date: Mon, 20 Nov 2000 02:38:58 -0000
>> Message-ID: <8v9n3j$3fjv1$1...@ID-55970.news.dfncis.de>
>
>
>Hi,
>
>About your previours mail about that one can't find
>all previours mails at the Google.
>
>I just tried to figure out something about this topic.
>So, I visited Google using one of my replys to Laura,
>--Exact this, pasted:
>
> echo. Input, (To Quit: Press Enter, then press Escape key:)
> choice /n /c:All keys | find "ASCII value 7"
>
>So, I have now searched some old messages from between august
>26'th and 29'th about my replys on this subject:
>ASCII value 7 character returned by Choice (detecting Enter).
>Message id maybe: 3b8be9da...@news.cis.dfn.de
>
>It seams that Google have missed my replys and I guess that
>it's because that I also wrote alot of not interesting stuff
>at that time, so, I really hope that Laura have made a note
>because; I don't like to loose credit.
>

Luckily I've been archiving a.m.b since January this year
and August is still in my newsreader (got 265Mb of newsreader
data files alone on disc!)

Anyhow I've put copies of the 2 threads (both starting 26th August,
Subjects;'Don't read this' & 'Laura' ) here for you;

http://lf.1accesshost.com/AA.TXT
http://lf.1accesshost.com/AA.HTM

UNIX message file format with all headers.

byefrom

--
: ${L:-aura} # http://lf.1accesshost.com
: # http://lf.8k.com:80


0 new messages