GENER batch command sets ON or OFF value to environment variable TR.
Normally every batch command starts with "@ECHO OFF" to suppress batch tracing. When it is necessary to release tracing, OFF can be changed temporarily to ON, and then back to OFF, after debugging is over.
This process quickly becomes annoying when several linked batch commands are involved in processing. There is an old technique, to start every batch command with "@ECHO %TR%", which gives the ability to switch tracing OFF/ON easily by setting an appropriate value to the TR environment variable ("SET TR=ON" or "SET TR=OFF").
TR command used with the appropriate parameter can simplify this setting procedure (if parameter is omitted, tracing mode is toggled from the current one).
Demo of GENER command operation can be found below the command text.
Note: | AUTOEXEC.BAT or AUTOEXEC.NT should contain command "SET TR=OFF" — Tracing is OFF. |
: GENER Genertional File Management 12/01/1994-10/15/1998 : --------------------------------------------------------- : Copyright (C) 1994-1999 by Vladimir Veytsel : 1. Generational file path (NB: Close by "\"; E.g.: A:\ or A:\BATCH\) : "?" - Displaybatch command text (Equivalent: "/") : 2. Generational file name base - i.e. without generation number : (Generation names would be - E.g.: SYNC-3) : or for names longer than 6, E.g.: CONSULT5) : 3. Generational file extension : 4. Maximum generation number (Default: 9, 1-9) : (Maximum generation number is enforced within 1-9 range) : Pushes files from Max gener to 0 making space for Max generation filling : E.g.: 0 1 2 3 4 5 Source generational structure : / / / / / Pushed from 1 through 5 (original 0 is lost) : 0 1 2 3 4 New structure with gener # 5 available for filling : E.g.: CALL GENER C:,SYNC,ZIP : PKZIP -bC: -aopr C:\SYNC-9 A:\*.* : CALL GENER D:\BOYAN\UP-DOWN,CONSULT,PTR,5 : REN CONSULT.PTR CONSULT5.* @ECHO %TR% IF %1.==/. .OR. %1.==?. (LIST %_BATCHNAME ^ QUIT) SET MX=%4 ^ IF %MX%.==. .OR. %MX% GT 9 SET MX=9 ^ IF %MX% LT 1 SET MX=1 SET NM=%2 IFF %@LEN[%NM%] LT 7 THEN SET NM=%NM%- ELSE SET NM=%@SUBSTR[%NM%,0,7] ENDIFF IF EXIST %1%NM%?.%3 ATTRIB -RSH %1%NM%?.%3 /Q IF EXIST %1%NM%0.%3 DEL %1%NM%0.%3 /Q DO GN=1 TO 9 IF EXIST %1%NM%%GN%.%3 REN %1%NM%%GN%.%3 %1%NM%%@EVAL[%GN% - 1].%3 /Q IF %MX%.==%GN%. LEAVE ENDDO UNSET MX NM GN
Tue 9/28/99 20:32 C:\> TR |
Batch command tracing mode is now ON |
Tue 9/28/99 20:33 C:\> TR |
IF %1.==/. .OR. %1.==?. (LIST %_BATCHNAME ^ GOTO Finish) IF "%1"=="=" .OR. %@UPPER[%1].==C. GOTO Finish IF %1.==0. .OR. %@UPPER[%1].==OFF. (SET TR=OFF ^ GOTO Finish) IF %1.==1. .OR. %@UPPER[%1].==ON. (SET TR=ON ^ GOTO Finish) IFF %TR%.==OFF. THEN SET TR=OFF Batch command tracing mode is now OFF |