relevant code looks like this:
cd /d %~dp0
if exist filename.txt (
echo %date% %time% *** text... >> filename2.txt
echo ==============================
echo === text....... ===
echo === text....... ===
echo === text....... (text...) ===
echo === text (text...
echo === text...).
:loop
set /p "varx= text: "
if "%varx%" neq "xxxx" goto loop
... more script...
)
Have searched high and low for solutions...
was pointed in direction of If statement groupings here: https://www.petri.com/forums/forum/windows-scripting/general-scripting/57625-if-exists-file-was-unexpected-at-this-time - NO GO
was pointed in direction of problems with loops in If blocks, here: (Windows batch) Goto within if block behaves very strangely - NO GO
Was pointed in direction of using @setlocal enabledelayedexpansion or @setlocal enableextensions (can't track down where) - NO GO
tried passing filename via set /p varfile="filename" and if exist %varfile% - NO GO
of course thought there were other parts of code causing error -- NO GO
The thing is that this WAS working for a long while...then I changed what I thought was some innocuous stuff and cannot figure out where the problem lies...
such an obscure problem to solve..ugh!