From ts@uwasa.fi  Mon Dec 31 12:00:00 2019
From: ts@uwasa.fi (Timo Salmi)
Subject: pc/pd2/tspost28.zip file description
To: ts@uwasa.fi  (Timo Salmi)
Date: Mon, 31 Dec 2019 12:00:00 EET
Status: RO

********* This file is still under construction ******************

+---------------------------------------------------------------+
! This file is in mail format, so you can also read it with any !
! suitable Unix mail program such as elm: (elm -f post28.txt).  !
! On a PC /pc/mail/rmail*.zip is a convenient alternative       !
+---------------------------------------------------------------+

   This is the twenty-eigth file that contains my replies and
comments that I or others have made by email, or just written here
instead of posting to (mainly to) news:comp.archives.msdos.d, or
postings that I wanted to retain for your information.
   Note that the latest tspost??.zip is always being updated until
it contains 30 messages. The files are located at the /pc/pd2
directory.
   For an index of all the completed tspost*.zip files please see
ftp://garbo.uwasa.fi/pc/pd2/tspost00.zip.

Please note that this index is in reverse order:

1   Dec 31 Timo Salmi         (57)   pc/pd2/tspost28.zip file description
2   Feb 15 Phil Robyn         (86)   Ruler
3   Jan 11 David Devore       (60)   How get today's date elements
4   Oct 28 Dave Jenkins       (105)  A possible contribution to your MS-DOS batch f
5   Feb 4  Matthias Tacke     (37)   Suggestion for Tscmd 049
6   Oct 27 Timo Salmi         (44)   Re: SetSer.exe Query
7   Feb 6  Timo Salmi         (43)   Re: Virus infection in PC/DOS area
8   Oct 28 rlively@earthlink. (125)  Security batch file and "solid" zip archives
9   Oct 24 Timo Salmi         (44)   Re: tsutlc26.zip Timo's 3rd utility set
10  Oct 22 Timo Salmi         (33)   Better Garbo Descritions (Was Re: ascii dictio
11  Apr 4  Eric Pement        (71)   improvement on TSBAT
12  Mar 13 Clifford Stern     (28)   Testing for zero byte file
13  Dec 18 Robert G. Durnal   (57)   Testing for disk presence in a batch
14  Nov 25 Timo Salmi         (38)   Re: DOS batch file page
15  Nov 7  Timo Salmi         (88)   Re: Weekly ftplog for Timo's files
16  Sep 21 Timo Salmi         (32)   Re: DOS command.
17  Sep 19 Timo Salmi         (38)   Re: (Was) Retrieving date in a mmddyy format

   All the best, Timo

-- 
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html


From ts@uwasa.fi Tue Sep 19 05:55:32 2000
From: ts@UWasa.Fi (Timo Salmi)
Subject: Re: (Was) Retrieving date in a mmddyy format
To: A Garbo User <>
Date: Tue, 19 Sep 2000 05:55:32 +0300 (EET DST)
X-Status: 
X-Keywords:                 
X-UID: 2
Status: RO

> > ftp://garbo.uwasa.fi/pc/ts/tsfltc22.zip More textfile-filters, T.Salmi
> > Filename        Comment                             Date      Time
> > FILE_ID.DIZ     Brief characterization of TSFLTC  09-27-98  05:25:08
> > TSFLTC.INF      Document, a readme                08-18-00  07:12:44
> > TSFLTC.NWS      News announcements about tsfltc   08-18-00  07:20:40
> > TSPROG.INF      List of programs from Timo Salmi  03-26-00  18:03:18
> > VAASA.INF       Info: Finland, Vaasa, U of Vaasa  10-18-97  13:18:46

> why do you not use some .txt extension for those (ascii) document files ?
> That is no problem for me, but maybe for some win users, it could avoid

Dear Sender,

Thank you for the welcome feedback. It is too late to change since I
adopted the (bad) convention years ago and have it in over fifty
packages. Furthermore, my programs date back to the days when
Windows was not yet a real option. Thus my programs basically are
vanilla MS-DOS programs with no consideration of potential
Windows-related problems.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

From ts@uwasa.fi Thu Sep 21 07:06:28 2000
From: ts@UWasa.Fi (Timo Salmi)
Subject: Re: DOS command.
To: Philip Carley <philip.carley@cmg.nl>
Date: Thu, 21 Sep 2000 07:06:28 +0300 (EET DST)
X-Status: 
X-Keywords:                 
X-UID: 3
Status: RO

Dear Philip

>  I saw you Batch file tips - very nice.

Thank you! I am glad that you liked my

 167461 Mar 31 2000 ftp://garbo.uwasa.fi/pc/ts/tsbat61.zip
 tsbat61.zip A collection of useful batch files and tricks, T.Salmi

>  Were you aware of the command TRUENAME in DOS 5.0 later (and 95 and 98)
>  It shows the full path and also good for full network UNC's

Yes, I am aware of this undocumented MS-DOS command.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

From ts@UWasa.Fi Tue Nov  7 22:31:41 EET 2000
From: ts@UWasa.Fi (Timo Salmi)
Newsgroups: comp.archives.msdos.d,alt.comp.freeware
Subject: Re: Weekly ftplog for Timo's files
Date: 7 Nov 2000 21:27:21 +0200
Organization: University of Vaasa
X-Status: 
X-Keywords:                 
X-UID: 4
Status: RO

In article <oHTN5.82563$hk2.201734@news6-win.server.ntlworld.com>,
Mike Jones <No thanks!> wrote:
:"Timo Salmi" <ts@UWasa.Fi> wrote in message
:[snipped a whole lot of stuff, some from 97]
:>
:>  126733 Apr 27 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqn.zip
:>  tsfaqn.zip Questions from Usenet and Timo's answers, linked

:What's the point of a weekly update
                              ^^^^^^
:when the last updated file was April!

Dear Mike,

A weekly update? What _update_? This is a download statistics list.
If someone finds it useful to download material from way back then,
then it shows. Simple as that.

If this statistics is not of interest to you, the solution is easy.
Killfile the subject. The subject header is kept constant to make
the option as easy as possible to use.

As for the list of the (few) new Garbo acquisitions, that list is
posted once a month.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html


-From ts@UWasa.Fi Tue Nov  7 22:32:12 EET 2000
-From: ts@UWasa.Fi (Timo Salmi)
-Newsgroups: comp.archives.msdos.d,alt.comp.freeware
-Subject: Re: Weekly ftplog for Timo's files
-Date: 7 Nov 2000 22:28:19 +0200
-Organization: University of Vaasa

In article <okZN5.83264$hk2.215413@news6-win.server.ntlworld.com>,
Mike Jones <No thanks!> wrote:
:Ah, I see now. Is anyone else interested in Prof Salmi's stats, or is it
: just me that can't see the relevance to acf? I hope you don't mind the
: question.

Dear Mike,

Not at all. I do not mind the question. However, my statistics
postings are not subject to a common vote. The question is whether
the subject is in line with the acceptable topics of the newsgroups
where I posted, not whether the subject is interesting or exiting.
The newsgroup news:comp.archives.msdos.d is about the material on
program archives, news:alt.comp.freeware is about freeware. The
answer is an unequivocal on-topic on both accounts. Thus the posting
decision is mine, and mine alone, not anyone else's.

:If they are of importance, please let me know.

Now the question of perceived importantce is entirely your own
subjective decision to make. I decide whether I post, you (and
anyone else) decide whether you read or not.

As for personally letting you know, I am sorry, but I do not provide
such a service. Furthermore, I have no means or even interest in
trying to guess what your true email address might be.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html


From ts@UWasa.Fi Sat Nov 25 08:06:41 2000
Subject: Re: DOS batch file page
From: ts@UWasa.Fi (Timo Salmi)
To: Kerry Davis <kedavis@uswest.net>
Date: Sat, 25 Nov 2000 08:06:41 +0200 (EET)
X-Mailer: ELM [version 2.4ME+ PL66 (25)]
X-Status: 
X-Keywords:                 
X-UID: 5
Status: RO

> I was looking at your posted DOS batch file tricks on the web page, and one
> thing that never seems to be made clear is, are these tricks intended for
> use in "pure" DOS?  Or do they only work in a DOS "window" within Windows?

Dear Kerry,

It is a good question. This is how it goes with

 168498 Sep 22 2000 ftp://garbo.uwasa.fi/pc/ts/tsbat62.zip
 tsbat62.zip A collection of useful batch files and tricks, T.Salmi

Originally, when I started writing this FAQ-like batch tricks
collection, MS-DOS still was the dominating OS. The Windows
supremacy started a bit later. My collection still is a vanilla
MS-DOS collection, but some, if not many of the tricks work in a
Windows 3.1x and even a Windows 95/98 Dosbox. However, that is more
or less coincidental. There are no guarantees, nor are there meant
to be beyond MS-DOS 6.22.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

From afn21533@afn.org Mon Dec 18 22:13:30 2000
Date: Mon, 18 Dec 2000 15:13:22 -0500 (EST)
From: afn21533@afn.org (Robert G. Durnal)
To: ts@uwasa.fi (Timo Salmi)
Subject: Testing for disk presence in a batch
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Status: 
X-Keywords:                 
X-UID: 6
Status: RO

 Prof Salmi:
         Just finished reading the latest 1BATFAQ.TXT from TSBAT62.ZIP. My
 particular response is directed toward #55, regarding presence or absence
 of a disk in a floppy drive. I wrote a *small* assembly file to set the
 errorlevel in a .BAT file, and the whole thing is much more compact than
 your .BAT only method. Since you have many .BAT files calling .COM files,
 I thought you might be interested in this one.
 DISKTEST.8    (I use the A86 assembler to avoid the boilerplate lines)
 DISKTEST or DISKTEST a for drive a; DISKTEST b for drive b
 =========
 .radix 16
  mov si,80
  lodsw     ; Get the count and space
  or al,al
  jz notail ; No tail = A
  lodsw
  dec al
  and al,1  ; 0=A, 1=B
 NOTAIL:
  mov bx,200
  mov cx,1
  xor dx,dx
  int 25     ; Attempt 1 sector read
  db 0D6     ; Opcode for SALC (undoc)
  popf       ; Special INT 25 requirement
  mov ah,4c
  int 21
 =============
         And the .BAT file using it, in part:
 DISKID.BAT
 =========
 @echo off
 disktest
 if errorlevel 255 goto nodisk
 dir a: | find "Volume in drive" > con
 goto end
 :nodisk
 echo THERE IS NO DISK IN DRIVE A:
 :end
 ============
 My home page URL=http://www.afn.org/~afn21533/          Robert G. Durnal
 Hosting RIJNDAEL, the AES winner, in CFB block          afn21533@afn.org
 chaining mode with key hashing. Executable only       afn21533@my-deja.com
 479 bytes. Download as tinyrijn.zip


From ax810@lafn.org Tue Mar 13 19:35:08 2001
Date: Tue, 13 Mar 2001 09:34:44 -0800
To: Timo Salmi <ts@uwasa.fi>
From: Clifford Stern <ax810@lafn.org>
Subject: Testing for zero byte file
X-Status: 
X-Keywords:                 
X-UID: 7
Status: RO

Regarding item #95 concerning the testing for a zero byte file, I would
suggest the following, based upon your note at the end of #32:

type %1 | find /v /n "&$&$&$123" | find "[1]" > nul
if errorlevel 1 goto k

in which branching occurs if the file is found to be empty. I have been
successfully using this idea in my own applications.

I'm new to batch files, and have found your "Assorted Batch Tricks" to be
of immense value.

Sincerely,

Clifford Stern
Santa Monica, California
USA

From pemente@northpark.edu Thu Apr  5 05:26:29 2001
From: "Eric Pement" <pemente@northpark.edu>
To: ts@uwasa.fi
Date: Wed, 4 Apr 2001 20:23:10 -0500
Subject: improvement on TSBAT
X-Status: 
X-Keywords:                 
X-UID: 8
Status: RO

Here are some better ways to handle certain questions:

Quoting 1BATFAQ.TXT, from TSBAT67.ZIP, question #16:

  echo %1|gawk -F. '{printf "set exten_=%%s\n",$2}'>tmp$$$.bat
  call tmp$$$.bat
  if not "%exten_%"=="" echo The extension in %1 is %exten_%
  if "%exten_%"=="" echo No extension in %1
  if exist tmp$$$.bat del tmp$$$.bat
  set exten_=
  goto _end


Here is a quicker way to write that:

echo %1|gawk -F. '{print "The extension in", $0, "is",($2=="" ? missing : $2) "."}'

The preceding should all be on one line. The only other thing I would
add here is that GNU awk's syntax of

     '{this..."and that"...}'

is only supported in the DJGPP compiled versions of gawk. Gawk is
normally distributed with TWO different versions compiled for MS-DOS.
One, compiled with DJGPP and the other compiled with either GNU Win32
or Mingw32. Only the version compiled with 32-bit DJGPP supports the
nicer quote syntax. The Win32 compilation forces awk users to do:

     "{this..\"and that\"...}"

which is usually more difficult to read and write.


--------------------------

Question #29:

A G(nu)AWK-based auxiliary program solution would be
  @echo off
  set test_=Testing the length of a string
  echo %test_%|gawk '{ printf "set length_=%%s\n", length() }'>len$&$&$.bat
  call len$&$&$.bat
  echo The length is %length_% bytes
  set length_=
  if exist len$&$&$.bat del len$&$&$.bat

Easier to do:
  @echo off
  set test_=Testing the length of a string
  echo %test_%|gawk '{print "The length is",length,"bytes"}'


Kind regards,

Eric Pement

--
Eric Pement - pemente@northpark.edu
5139 N. Christiana, Apt. 2, Chicago, IL 60625
Phone: (773) 539-7479

From ts@UWasa.Fi Tue Oct 23 07:07:41 EET 2001
From: ts@UWasa.Fi (Timo Salmi)
Newsgroups: comp.lang.pascal.borland
Subject: Better Garbo Descritions (Was Re: ascii dictionary)
Date: 22 Oct 2001 21:12:40 +0300
Organization: University of Vaasa
Message-ID: <9r1nio$6q0@poiju.uwasa.fi>
X-Status: 
X-Keywords:                 
X-UID: 9
Status: RO

Dr John Stockton  <jrs@merlyn.demon.co.uk> wrote:
> news:comp.lang.pascal.borland, Timo Salmi <ts@UWasa.Fi> wrote at Tue, 16
> >http://garbo.uwasa.fi/pc/spell.html

> Might I suggest that the entries in that page need to be annotated to
> show clearly, in each case, which language they are designed for?  UK
> English and US English are different.

John, that, in fact, is a Garbo FAQ, although *SO* old that even you
might not recall it. In brief, such ideas are good, sound and
welcome, but as a rule there is no one here to do the local work
required.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

From ts@UWasa.Fi Wed Oct 24 05:48:19 EET 2001
From: ts@UWasa.Fi (Timo Salmi)
Newsgroups: alt.msdos.batch,comp.archives.msdos.d
Subject: Re: tsutlc26.zip Timo's 3rd utility set
Date: 24 Oct 2001 05:39:08 +0300
Organization: University of Vaasa
Message-ID: <9r59kc$e30@poiju.uwasa.fi>
X-Status: 
X-Keywords:                 
X-UID: 10
Status: RO

Frank Groe <frank.grosse@fh-zwickau.de> wrote:
> Why do I get Runtime Error 202 on some tools (like doubles, hidden,
> readonly)?
> System: Win2k SP 2, Pentium II-400, 512 MB Ram

It is about
 111711 Oct 23 2001 ftp://garbo.uwasa.fi/pc/ts/tsutlc26.zip
 tsutlc26.zip Timo's 3rd utility set (dirf,dirinfo,doubles,hidden,split,...)

The error 202 is "Stack overflow error"

Those particular programs in the package obviously run out of stack
since they are internally based recursion in traversing the
directory trees. This is an affliction that occurs if your hard disk
has very many directories and files. Also note that these programs
are strictly 16bit MS-DOS programs. Written and compiled as such.
Thus long files names are another potential source of the stack
overflow problem, as might be the Win2k environment (that I do not
know). Unfortunately there is nothing to be done when _any_ of those
is the true source of the problem since I already have set the stack
value high some versions ago. The only option then is to use other
programs and maybe even batch solutions.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html


From rlively@earthlink.net Mon Oct 29 06:40:42 2001
From: rlively@earthlink.net
To: "Prof. Timo Salmi" <ts@uwasa.fi>
Date: Sun, 28 Oct 2001 22:41:33 -0600
Subject: Security batch file and "solid" zip archives
X-Status: 
X-Keywords:                 
X-UID: 11
Status: RO

Following the text is a "security" batch file I use to clean off
diskettes (and hard disks too) to foil the unerase and unformat
commands. You run the batch file where you want to clean (a:, chdir
\temp, etc.). It overwrites all the "erased" filespace with question
marks and all the "erased" filenames (up to 2500) with _ERASED_._??
to make recovery difficult. (The .bat can be cut down to 2K if you're
counting bytes on a diskette). I know it does not meet the military
specification of permanent erasure, but it works for me.

Also, did you know you can further reduce the size of your .zip files
(more like tar/gzip) by zipping all the files together with NO
compression and then zipping that file? (Some compression software
call this a "solid" archive). The savings comes from "reusing" the
compression table between ALL the files. The downside is that if the
.zip is damaged, you may not be able to recover ANY of the files

using info-zip 2.3...
tsbat68.zip
 516,000 bytes in 83 files
 526,070 bytes in 1 file (stored file information takes another 10k)
 147,910 bytes in "solid" zip file
 (was 187,136 bytes in original zip file)

Rick.
PS. Thanks for all your work!

--B<-- batch file begins here... (1st 2 chars line number, 1 char
space)...
01 @echo off
02 ::---- overwrite up to 2500 "erased" filenames and content
03 ::CALL %0
04 ::CMD  COPY DIR ERASE TYPE
05 ::ENV  none
06 ::FILE _ERASED_.???
07 ::NOTE Can pickup where left off if interrupted
08  for %%f in (_2 _3 _5 _6) do if "%1"=="%%f" goto l%%f
09  echo %0 STARTING
10  if exist _ERASED_._?? goto l_7
11  echo  NOTE YOU MAY SEE THE FOLLOWING MESSAGES:
12  echo   INSUFFICENT DISK SPACE,
13  echo   FILE CREATION ERROR,
14  echo   FILE(S) COPIED
15  if "%1"=="fn" goto l_1
16  if "%2"=="fn" goto l_1
17  goto l_0
18 :l_0 ------- fill up all "unused" disk space ---
19  echo
??????????????????????????????????????????????????????????????>_ERASED
_.001
20  COPY /B _ERASED_.001+_ERASED_.001+_ERASED_.001+_ERASED_.001
_ERASED_.000>NUL
21  ERASE _ERASED_.001
22  call %0 _2 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M
23  for %%f in (M L K J I H G F) do if not exist _ERASED_.10%%f if
exist _ERASED_.00%%f COPY _ERASED_.00%%f _ERASED_.10%%f>NUL
24  for %%f in (E D C B A 9 8 7) do if not exist _ERASED_.10%%f if
exist _ERASED_.00%%f COPY _ERASED_.00%%f _ERASED_.10%%f>NUL
25  for %%f in     (6 5 4 3 2 1) do if not exist _ERASED_.10%%f if
exist _ERASED_.00%%f COPY _ERASED_.00%%f _ERASED_.10%%f>NUL
26  call %0 _3 8 7 6 5 4 3 2 1
27  DIR
28  ERASE _ERASED_.?0?
29  goto l_1
30 :l_1 ------- replace erased filenames in dir ---
31                        call %0 _5 %0 ! %0 # %0 $ %0 ( %0 ) %0 - %0
0 %0 1 %0 2 %0 3 %0 4 %0 5 %0 6 %0 7 %0 8 %0 9
32  if exist _ERASED_._9_ call %0 _5 %0 @ %0 A %0 B %0 C %0 D %0 E %0
F %0 G %0 H %0 I %0 J %0 K %0 L %0 M %0 N %0 O %0 P
33  if exist _ERASED_._P_ call %0 _5 %0 Q %0 R %0 S %0 T %0 U %0 V %0
W %0 X %0 Y %0 Z %0 [ %0 ] %0 _ %0 ` %0 { %0 } %0 ~
34  DIR /w
35  ERASE _ERASED_._??
36  goto l_8
37 :l_2 ------- copy file to next at double size --
38  shift
39  if not exist _ERASED_.00%2 if exist _ERASED_.00%1 COPY /B
_ERASED_.00%1+_ERASED_.00%1 _ERASED_.00%2>NUL
40  if exist _ERASED_.00%2 if not "%3"=="" goto l_2
41  goto lEnd
42 :l_3 ------- find the blocksize ----------------
43  shift
44  if exist _ERASED_.00%1 COPY _ERASED_.00%1 _ERASED_.000>NUL
45  if not "%1"=="" if not exist _ERASED_.000 goto l_3
46  goto l_4
47 :l_4 ------- backfill files to blocksize -------
48  shift
49  COPY _ERASED_.000 _ERASED_.00%1>NUL
50  if not "%2"=="" goto l_4
51  goto lEnd
52 :l_5 ------- make multiple files ---------------
53  shift
54  shift
55                         call %0 _6 . %1 ! %1 # %1 $ %1 ( %1 ) %1 -
%1 0 %1 1 %1 2 %1 3 %1 4 %1 5 %1 6 %1 7 %1 8 %1 9
56  if exist _ERASED_._%19 call %0 _6 . %1 @ %1 A %1 B %1 C %1 D %1 E
%1 F %1 G %1 H %1 I %1 J %1 K %1 L %1 M %1 N %1 O %1 P
57  if exist _ERASED_._%1P call %0 _6 . %1 Q %1 R %1 S %1 T %1 U %1 V
%1 W %1 X %1 Y %1 Z %1 [ %1 ] %1 _ %1 ` %1 { %1 } %1 ~
58  if not "%3"=="" if exist _ERASED_._%1~ goto l_5
59  goto lEnd
60 :l_6 ------- make individual file --------------
61  shift
62  shift
63  TYPE NUL>_ERASED_._%1%2
64  if not "%3"=="" if exist _ERASED_._%1%2 goto l_6
65  goto lEnd
66 :l_7 ------- filename already exists -----------
67  echo %0 _ERASED_._?? ALREADY EXISTS
68  goto l_8
69 :l_8 ------- ending message --------------------
70  echo %0 ENDING
71  goto lEnd
72 :lEnd ------ end of batch file -----------------
--B<-- batch file ends here...

From ts@uwasa.fi Thu Feb  6 12:28:37 2003
From: ts@UWasa.Fi (Timo Salmi)
Subject: Re: Virus infection in PC/DOS area
To: A Garbo User <>
Date: Thu, 6 Feb 2003 12:28:37 +0200 (EET)
X-Status: 
X-Keywords:                 
X-UID: 12
Status: RO

Dear Garbo User,

> i appreciate it very much to get the collection of dos-tools,
> remembers us a time from the past and still existing in the
> network.

I am very pleased to hear this.

> By running f-prot with option /Archive there is a report on
> the PUB\PC\KEYBOARD\PB16.ZIP. The file MENU.COM
> is reported as to be infected by SillyC or variant.

Thank you for bringing this to my attention. Even if about 99%
reports of virus infections turn out to be a result of some
misunderstanding, this one indeed has somehow managed to slip
through our sieve. Therefore, I will be giving a public notification
on the Usenet news. I have removed

 27669 Mar 22 1991 ftp://garbo.uwasa.fi/pc/keyboard/pb16.zip
 pb16.zip A TSR Playback! of keystrokes v1.6

from Garbo archives. It is conceivable that it is the TSR code that
triggers the heuristic warning, but be that as it may, I am not
taking any chances.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

From ts@poiju.uwasa.fi Mon Oct 27 14:31:54 2003
Date: Mon, 27 Oct 2003 14:31:54 +0200
From: Timo Salmi <ts@poiju.uwasa.fi>
To: Charles Goh <>
Subject: Re: SetSer.exe Query
Content-Type: text/plain; charset=us-ascii
X-Status: 
X-Keywords:                 
X-UID: 13
Status: RO

On Mon, Oct 27, 2003 at 09:18:24AM +0800, Charles Goh wrote about:
 ftp://garbo.uwasa.fi/pc/ts/ts5dos11.zip MsDos 5 (or 4) programs, T.Salmi
 SETSER.EXE      Set the disk's serial number      Sep-11-1992  07:32:28

> I have downloaded your above program SetSer.exe. I have problems in
> getting the program to change my Volume. I follow the instructions
> closely and the volume is still an old one. Is there anything I should
> do? I am running on windows 2000 and trying to change the volume of C
> drive. I appreciate if you can advise me.

Dear Charles,

I am pleased to hear that you have one of my programs.
Unfortunately, there is nothing that I can do about the problem,
since my programs have been written for MS-DOS. The NT/Win2k/XP
series is based on a different kind of a base, which might be the
cause. The only thing I can think of is trying the program in a
command.com, not cmd.exe window. Be aware though, since you have a
different platform, programs meant for a different environment could
cause problems.

It is so long since I wrote that program, but I have a vague
recollection that I wrote it for diskette drives (A: B:) only. I
am not sure.

   All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland
Timo's  FAQ  materials  at   http://www.uwasa.fi/~ts/http/tsfaq.html

From matthias@tacke.de  Wed Feb  4 19:40:51 2004
Message-ID: <004b01c3eb45$aebd7af0$4403a8c0@mars>
From: "Matthias Tacke" <Matthias@Tacke.de>
To: "Salmi, Timo" <ts@uwasa.fi>
Subject: Suggestion for Tscmd 049
Date: Wed, 4 Feb 2004 18:38:21 +0100
X-Status: 
X-Keywords:                 
X-UID: 14
Status: RO

Hello Timo,

in need for a solution for Bernhard Wiz in mpwca I modified your Tip049
in TSCMD to work without calling a sub, instead using delayedexpansion.

@echo off & setlocal enableextensions enabledelayedexpansion
:: Make a test file
set fileName=%temp%\mytest.txt
set TmpFile=%temp%\mytemp.txt
for %%f in (%fileName% %TmpFile%) do if exist %%f del %%f
for %%f in (1 2 3 4 5 6 7 8 9) do echo This is line %%f>>%fileName%
::
:: Get the number of lines
for /f %%a in ('find /v /c "" ^< %fileName%') do set /a lineCount=%%a -1
::
:: Loop through the lines of the file from the last line to the first
for /l %%a in (%lineCount%,-1,0) do (more /e +%%a %fileName%>%TmpFile%
set /p Nth_line=<%TmpFile% &echo !Nth_line!)
::
:: Clean up
for %%f in (%fileName% %TmpFile%) do if exist %%f del %%f

BTW your original tip has some unused endlocal / goto :eof lines.

Greetings Matthias

From Dave_Jenkins  Thu Oct 28 21:15:00 2004
Subject: A possible contribution to your MS-DOS batch files tips and tricks FAQ
From: Dave Jenkins <>
Date: Thu, 28 Oct 2004 21:15:00
To: Timo Salmi
X-Status: 
X-Keywords:                 
X-UID: 15
Status: RO

Professor Salmi,

Please know that I am not asking anything of you.  I am offering you
technical information you may or may not have. You probably don't
recognize my name, but we have corresponded a few times over the
past decade or two. As always, thanks for all your useful references
and such over the years.  It is a great service and one that is
appreciated.

Here is a trick I had been looking for off and on for a long time
but did not find even in your MS-DOS batch files FAQ.  Now that I
finally figured it out I thought I should share it:

I use the MS-DOS SET command's environment variable substitution for
many things.  One simple example (that is particularly useful in the
java world where there are deep parallel trees of .java (source)
files and .class (object) files) is this command that basically says
"Save wherever I am in the source tree and CD to the same place in
the parallel compiled debug tree" (this assumes that Command
Extensions are enabled so the %cd% environment variable is set):

        pushd %cd:\Source\=\bin\debug\%

But often such substitutions are neither simple nor fixed.  The
trick I was looking for was for those times when either or both
sides of the substitution are variable as well.  In the above case,
perhaps you want to CD to either ...\bin\debug\... or
...\bin\release\... based on a command line argument...

Q: Is there any way to use/nest an environment variable reference in
the middle of an environment variable substitution to allow for
dynamic substitutions?

A: MS-DOS will not allow anything with a % (either a parameter
reference like %1 or an environment variable reference like %var%)
inside an environment variable substitution.  So, for example:

        pushd %cd:\Source\=\bin\%1\%

in a .bat or .cmd file would not allow you to insert "debug" or
"release" into the above command.  The '%' of "%1" ends the
substitution and no amount of doubling or tripling or escaping of
'%'s makes it work the way you want.

However, you can take advantage of the way the command processor
handles parameters on call statements (internal or external).

You can construct an entire command dynamically and then pass the
command as parameters in a call to have it executed.  For example:

----- begin sample1.cmd -----
call :do_it pushd %%cd:\source\=\bin\%1\%%
goto :eof

:do_it
%*
goto :eof
----- end sample1.cmd -----

The pushd command and substitution syntax, complete with the
inserted parameter, is passed to do_it and the "%*" line expands to
the entire parameter list and is executed as a single command line.

A more generic example might be this one that demonstrates
substitution of any arbitrary string within another arbitrary
string:

----- begin sample2.cmd -----
set x=abcdefghi
set from=def
set to=XYZ
call :do_it set x=%%x:%from%=%to%%%
echo %x%
goto :eof

:do_it
%*
goto :eof
----- end sample2.cmd -----

I hope you find this information useful and worth the time you have
taken to read it. Should you find this useful, you are most welcome
to use it in any way you see fit.  No credit is necessary.

*** Please do not use or include my email address anywhere or for
anything other than our correspondence.  Thank you. ***

Dave Jenkins
eiStream WMS, Inc.
One Tara Blvd, Suite 200
Nashua, NH 03062-2809
Tel: 603-459-0909, 888-242-3518 x1909
Fax: 800-526-6675


From David_Devore Tue Jan 11 21:17:03 2005
Date: Tue, 11 Jan 2005 14:03:06 -0500
From: David Devore <>
To: Timo Salmi
Subject: How get today's date elements
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Status: 
X-Keywords:                 
X-UID: 16
Status: RO

Greetings,

May I suggest an easier solution to:
Subject: 59. How get today's date elements into environment variables?

the following code seems to work OK with WIN2000 and XP
*********************************************************************************
@echo off
rem Get the date - store in env variable formatted as yymmdd
rem d. devore

setlocal
FOR /F "tokens=1,2,3,4,5* delims=/ " %%i IN ("%date%") DO (SET
daynam_=%%i & SET mo_=%%j & SET day_=%%k & SET yr_=%%l)

SET yr_=%yr_:~2,2%
SET mo_=%mo_:~0,2%

echo today's date is %date%
echo.
echo day of the week is %daynam_%
echo year.month.day (formatted as yymmdd) is %yr_%%mo_%%day_%
endlocal
pause 
*********************************************************************************

likewise, "DATEDIR.BAT" could be simplified (no need to write files to
the hard drive).  see code below

*********************************************************************************
@echo off
rem Displays updated files from today, sorted by descending time
rem d. devore

@echo.
echo Displays all files from c:\ drive updated on %date%
echo Press [CNT + C] to abort, else
pause
rem Get the date - store in local env variable date_

setlocal
FOR /F "eol=; tokens=2,3* delims=, " %%i IN ("%date%") DO (SET
date_=%%i)
dir c:\ /s /a:-d | find "%date_%" | sort /+12 /R | more
endlocal
pause
*********************************************************************************

From ts@pat.uwasa.fi Fri Feb 16 10:47:47 2007
Date: Thu, 15 Feb 2007 00:39:02 -0800
From: Phil Robyn <probyn@berkeley.edu>
To: Timo Salmi <ts@uwasa.fi>
Subject: Ruler
Status: RO

Timo Salmi wrote:
> Wed 14-Feb-2007: I have made an update
> 
>  192436 Feb 14 2007 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
>  tscmd43.zip Useful NT/2000/XP script tricks and tips, T.Salmi
> 
> Added the scripts
>  DATET.CMD   Put the current date parts into the environment
>              (Aka the mother of all command-line script FAQs)
> 
>  FINDTMP.CMD Find and list all the *.TMP files
>              (Mainly a demo of another top FAQ)
> 
>  RULER.BAT   An aid to pinpoint CLI screen colums and rows
> 
>  TSCD.CMD    Show current/given folder both in short and long formats
> 
>  WHOISME.CMD Get IP and user information
> 
> Added the following FAQ item to 1CMDFAQ.TXT
>  158} Why won't the statements within my if condition work properly?
> 
>    All the best, Timo
> 

Hi, Timo,

Here's another RULER.CMD (columns only but useful for measuring strings).

- - - - - - - begin screen capture WinXP MCE 2005 SP2 - - - - - - -
c:\cmd>ruler 0 55
0....+....1....+....2....+....3....+....4....+....5....+

c:\cmd>ruler 90
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9

c:\cmd>rlist util\ruler.cmd
=====begin c:\cmd\util\ruler.cmd ====================
01. @echo off
02. setlocal
03. set base=1
04. set length=%1
05. if not defined length set length=80
06. if %length%==0 (
07.    set base=0
08.    set length=%2
09. )
10. set /a cols = %length% + 10
11. set /a cols = cols / 10
12. set ruler=
13.
14. FOR /l %%a IN (1,1,%cols%) DO call :doruler %%a
15. if %base%==0 (
16.    set ruler=0%ruler%
17.    set /a length += 1
18. )
19. call echo %%ruler:~0,%length%%%
20. endlocal&goto :EOF
21.
22. :doruler
23. set num=%1
24. if 10 GTR %num% set ruler=%ruler%....+....%num%
25. if 10 EQU %num% set ruler=%ruler%....+....%num:~1,1%.
26. if 10 LSS %num% set ruler=%ruler%...+....%num%
27. goto :EOF
=====end   c:\cmd\util\ruler.cmd ====================

c:\cmd>ruler 0 50&echo/The quick brown fox jumps over the lazy dog.
0....+....1....+....2....+....3....+....4....+....5
The quick brown fox jumps over the lazy dog.

- - - - - - - end   screen capture WinXP MCE 2005 SP2 - - - - - - -

Best regards, and keep up the good work!

--
Phil Robyn
University of California, Berkeley (retired)

