|saw one similar to this and managed to find it:|
judago wrote good code for accomplishing this, which i took liberty to modify and use here (apologies to Judago if this is wrong thing to do, i'm new to forums)
oops again, i was away from my computer and submitted before i reverted to the thread, so my post is redundant. i like the version razor sent, i can learn from it.
test data, contents of file test:
@ECHO OFF && setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%a in (test) do (
if "!half:~-1!"=="\" set half="!half:~0,-1!"
for /f %%b in ("!half!") do (
:echo leading: !startvar!
echo trailing: !nn!\!endvar! >> xxx.bat