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

Request for help in XP to Win7 conversion

42 views
Skip to first unread message

dr.s.l...@gmail.com

unread,
Nov 25, 2016, 6:02:14 PM11/25/16
to
I have a WinXP batch file TRY.BAT which, for every *.HTM file in the current folder which has been altered since TRY.BAT was last run, calls another batch file with the name of the *.HTM file. TRY.BAT includes the line
copy /y nul TRY.LOG > nul
Earlier in TRY.BAT the timestamp of TRY.LOG is read, to be used to handle "altered since". Those actions use existing 16-bit Pascal programs, so TRY.BAT will not work in 64-bit Win7.

So, how in Win7 and Win10 Batch (and possibly in WinXP batch too) should I do this filename selection?

The following might help; I want to process all lines of its output following the line TRY.LOG :
dir /od /b *.htm try.log

Alternatively, I could probably with effort do the job in Windows Script Host JScript ...

It might be slightly useful to select also from subdirectories; /s with dir does that, of course.

--
SL

Herbert Kleebauer

unread,
Nov 26, 2016, 9:59:37 AM11/26/16
to
On 26.11.2016 00:02, dr.s.l...@gmail.com wrote:
> I have a WinXP batch file TRY.BAT which, for every *.HTM file in the
> current folder which has been altered since TRY.BAT was last run,
> calls another batch file with the name of the *.HTM file.


> The following might help; I want to process all lines of its output following the line TRY.LOG :
> dir /od /b *.htm try.log

setlocal enabledelayedexpansion
set flag=0
for /f %%i in ('dir /od /b *.htm try.log') do (
if !flag!==1 echo call another_batch.bat %%i
if %%i==try.log set flag=1
)


dr.s.l...@gmail.com

unread,
Nov 26, 2016, 12:55:12 PM11/26/16
to
On Saturday, November 26, 2016 at 2:59:37 PM UTC, Herbert Kleebauer wrote:
It works (after changing try.log to TRY.LOG to match the actual file name!), as expected. The changes to the called batch file should be easy. Thanks.

--
SL

dr.s.l...@gmail.com

unread,
Dec 1, 2016, 6:42:29 AM12/1/16
to
On Friday, November 25, 2016 at 11:02:14 PM UTC, dr.s.l...@gmail.com wrote:

> ...
> The following might help; I want to process all lines of its output following the line TRY.LOG :
> dir /od /b *.htm try.log
> ...

All is well; and it is better with dir /o-d /b and a branch out on finding TRY.LOG; then the flag is not needed and there is no need to give an initial TRY.LOG (all *.htm files will then be tested).

Query : the output of dir /b may contain lower-case characters. Is there an easy way to test %%i which contains a file name for looking unlike a traditional MSDOS 8.3 upper-case filename?


--
SL

pro...@berkeley.edu

unread,
Dec 1, 2016, 7:01:27 PM12/1/16
to
- - - - screen capture Win 7 Pro - - - -
>test C:\DOSBOX\WYLBUR\TLIB\XFONTS.WYL
test=C:\DOSBOX\WYLBUR\TLIB\XFONTS.WYL

>test c:\windows\wylbur\tlib\xfonts.wyl
Environment variable test not defined

>listit test.cmd
==========begin "C:\work\test.cmd" ==========
1. @echo off
2. for /f "tokens=* delims=:\.abcdefghijklmnopqrstuvwxyz" %%T in ("%~1") do set test=%%T
3. set test
4. goto :EOF
==========end "C:\work\test.cmd" ==========

(line 2 is wrapped)

--
Phil Robyn

dr.s.l...@gmail.com

unread,
Dec 3, 2016, 5:50:25 AM12/3/16
to
I see what the test in line 2 does, but I don't see how the line fits into what I want to be tested. But never mind; it made me think; I now use

rem Show if name has lower-case -
rem echo %%i | MTR -c- -o - [a-z]
echo %%i | MTR -c- -o - "([^a-z]*[a-z].*)" = "Lower case present in \1"

In that, MTR is 32-bit MiniTrue; a sort of combination of LIST, SED, AWK, and suchlike. in the commented-our code line, the echoed one-line text is tested, line by line, for the presence of a lower-case character, and any line containing such is output. The active line, working but not necessarily yet perfected, edits the output line.

MiniTrue is moderately large; but it is wanted for other tests within the files, and presumably will be in a RAM buffer for the duration of the batch file.

> (line 2 is wrapped)
No; your Line 2 was transmitted unwrapped. A displaying agent, including the sender's, may choose to wrap or truncate lines which are too long for the current width of its display element. (IIRC, that was a hardware setting on the glorious DEC VT100 terminal.)

--
SL
0 new messages