Hi everyone i am very new to batch scripting,As part of my project i need to add text in the middle of bunch of files,which i am able to do it successfully,but after copying the file to new location i noticed that the html tags are missing ,i tried every possible way to sort this out but failed in every attempt,Ironically I also noticed in windows 7 my script is working perfectly it is keeping the html tags intact,but when i check the same script in windows server 2012/2008,the html tags are missing,can any one suggest me what is should i do...
My Code snippet:
@echo off
set SrcFolder=C:Usersemlfilessample
set DstFolder=C:Usersoutput
FOR %%f in (%SrcFolder%*.eml) do ( (FOR /F "usebackq delims=" %%a in (`"findstr /n ^^ %%f"`) do ( SETLOCAL EnabledDelayedExpansion set "var=%%a" set "var=!var:*:=!" if "!var:~0,10" == "x-globalre" ( echo X-SUBTYPE=RETURES ) echo(!var! ENDLOCAL
)) >> "%DstFolder%%%~nxf"
)
After executing my script in server 2012..i am able to successfully inject the required text in the middle.....but as said the html tags are missing.....
**Sample input eml:**
Date Mon,20 mar 2017
From:[email protected]
To:[email protected]
Message-ID:<10091223>
Subject:Symphony
x-globalrelay-MsgType: XXXX
x-StreamType:xxxx
x-contentstartdate:XXX
<html><body> Message ID:sm9atRNTnMA=Yay1R0QgoH.............. </html>
Date Mon,20 mar 2017
From:[email protected]
To:[email protected]
Message-ID:<10091223>
Subject:Symphony
X-SUBTYPE=RETURES
x-globalrelay-MsgType: XXXX
x-StreamType:xxxx
x-contentstartdate:XXX
As said ironically i am able to generate the desired output in windows 8 locally with the same script.....i am not able to identify why it is giving different output in windows server 2012