Can you see if prefixing the above line with % % fixes the XP bug? That very well may be the problem.
Dave Benham
Moderator: DosItHelp
Can you see if prefixing the above line with % % fixes the XP bug? That very well may be the problem.
Code: Select all
(
FOR /F "tokens=*"%%a in ("
% %"<td><font color=#ffffff><b>Email Address</b></font></td>"%NL%
% %"</tr>"
% %) DO (
ECHO(%%~a
)
) >> "%WORKDIR%\%NEWDIR%\index.htm"
DarnAcy Forsythe wrote:Sadly... I tried both the % % and the un-indent methods and they both resulted in the bug.
The above is garbage The %NL% does not end with a caret so it does not escape the 1st character on the next line. The whole line should be moved all the way to the left.dbenham wrote:- You could indent with only one space. This will work because the %NL% macro will escape the leading space character on the next line. You don't want the lines to start with the quote because then the quote will be escaped and that will lead to complications.
Code: Select all
@echo off
setlocal enableDelayedExpansion
set LF=^
set NL=^^^%LF%%LF%^%LF%%LF%
cls
echo on
for /F "tokens=*" %%a in ("
"-------------------------"%NL%
,,,"</table> </center> <tr>"%NL%
;;;"<td valign=bottom bgcolor=#ffffff>"%NL%
==="<table border=0 width=100%% cellpadding=0 cellspacing=0>"%NL%
,,,"<tr>"%NL%
==="<td bgcolor=#123759 height=40>"%NL%
;;;"<table border=0 width=100%% cellpadding=0 cellspacing=0>"%NL%
"<tr>"%NL%
"<td width=10> </td>"%NL%
"<td valign=center><font color=#ffffff><b>Email Index</b></font></td>"%NL%
"<td align=right><font color=#ffffff>© Site_Name, Inc.</font><br>"%NL%
"<td width=10> </td>"%NL%
"</tr> </table> </td> </tr> </table> </td> </tr> </table>"%NL%
"</body>"%NL%
""%NL%
"</html>"
) DO @echo(%%~a
)
Code: Select all
:D:\utils>for /F "tokens=*" %a in (" "-------------------------"
: "</table> </center> <tr>"
: "<td valign=bottom bgcolor=#ffffff>"
: "<table border=0 width=100% cellpadding=0 cellspacing=0>"
: "<tr>"
: "<td bgcolor=#123759 height=40>"
: "<table border=0 width=100% cellpadding=0 cellspacing=0>"
: "<tr>"
: "<td width=10> </td>"
: "<td valign=center><font color=#ffffff><b>Email Index</b></font></td>"
: "<td align=right><font color=#ffffff>© Site_Name, Inc.</font><br>"
: "<td width=10> </td>"
: "</tr> </table> </td> </tr> </table> </td> </tr> </table>"
: "</body>"
: ""
: "</html>") DO @echo(%~a
:-------------------------
:</table> </center> <tr>
:<td valign=bottom bgcolor=#ffffff>
:<table border=0 width=100% cellpadding=0 cellspacing=0>
:<tr>
:<td bgcolor=#123759 height=40>
:<table border=0 width=100% cellpadding=0 cellspacing=0>
:<tr>
:<td width=10> </td>
:<td valign=center><font color=#ffffff><b>Email Index</b></font></td>
:<td align=right><font color=#ffffff>© Site_Name, Inc.</font><br>
:<td width=10> </td>
:</tr> </table> </td> </tr> </table> </td> </tr> </table>
:</body>
:
:</html>
The bug is indeed nasty and appears randomly depending on the internal state of the machine.Acy Forsythe wrote:Arrrghhh...
A Co-Worker asked what I was doing and as I was explaining it to them, I started getting the bug even with only using the last two lines, which previously and consistently was avoiding the bug...
I also wondered what that leading space was doing there, corrupting my batchThe clue is the very 1st line that is not preceded by %NL% but is preceded by a <LF>... It follows the initial (" after an intervening space. I think the <LF> is functioning as a token delimiter the same as any other token delimiter, and it is condensed into a space. It is also unescaped and unquoted, so it can lead to the XP bug.
It would be very easy though, only if I knew where this leading space is coming fromoutput:Code: Select all
prompt $
@echo on
set FileOpen=(%$n1c%
set RULE=!$ED.Path!^^^^^^^^%$n1c%
some%$n1c%
)The underscore represents a leading space.Code: Select all
set FileOpen=(
set RULE=!$ED.Path!^^^^
some
)
set FileOpen
FileOpen=(
set RULE=somepath^^
some
)
(
set RULE=somepath^
_some
)
some wordt niet herkend als een interne
of externe opdracht, programma of batchbestand.
set RULE
RULE=somepath^
echo.endoftest
endoftest
pause
Druk op een toets om door te gaan. . .
Or cheatI believe the only thing that is not random is that it will not appear if all token delimiters are escaped or quoted. The trick for your case is identifying the offending token delimiter.
Code: Select all
2>nul ( for something in some ,,, offending token do set something ) &for something in "something" do ...
dbenham wrote::idea: I have a theory
jeb - if you are there I think you will be interested in this
It's not only the first <LF>, each line produces the same problem.dbenham wrote:If I am correct, then jeb's FOR /F technique of iterating across multiple strings is INCOMPATIBLE with XP.
Unless jeb can figure out how to escape the <LF> while still treating each line seperately.
I haven't been able to make it work.
@echo off
setlocal EnableDelayedExpansion
set LF=^
set ^"NL=^^^%LF%%LF%^%LF%%LF%"
set "space= "
cls
echo onf
:loop
for /F "tokens=*" %%a in (^""One"%NL%^
%space%"two"%NL%^
%space%"three"%NL%^
%space%"four"^
") DO (
@echo('%%a' --- '%%~a'
)
goto :loop
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set LF=^
set ^"NL=^^^%LF%%LF%^%LF%%LF%^^"
cls
for /F "tokens=* delims=_" %%a in (^"%NL%
___"One"%NL%
___"two"%NL%
___"three"%NL%
___"four"%NL%
") DO (
@echo('%%a' --- '%%~a'
)
Yes, I realized that. But at first I thought the spaces were a result of how the parser formats multiple lines within a () code block. But then I noticed that the 1st line is on the same line as (" with an intervening space. I then realized this was an entirely different mechanism - the normal <LF> characters (those not in the %NL% macro) were being converted to spaces by the parser.jeb wrote:It's not only the first <LF>, each line produces the same problem.dbenham wrote:If I am correct, then jeb's FOR /F technique of iterating across multiple strings is INCOMPATIBLE with XP.
Unless jeb can figure out how to escape the <LF> while still treating each line seperately.
I haven't been able to make it work.