|
Answer» Hi everyone, Thanks for this siteit helped me a lot in doing my project but i am facing some issue,HOPE you can suggest me how to get out of this...
As part of a project I need to add text to the middle of many files using batch scripting. I am able to add the text successfully, but after copying the files to a new location I noticed that the HTML tags are missing. I only have this problem in Windows Server 2012/2008; in Windows 7 the HTML tags remain.
My Code snippet: echo off
set SrcFolder=C:\Users\emlfilessample set DstFolder=C:\Users\output
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" )
**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 Message ID:sm9atRNTnMA=Yay1R0QgoH..............
After executing my script in Server 2012 I am able to successfully inject the REQUIRED text in the middle, but as I said the HTML tags are missing:
**Sample output eml:** Date Mon,20 mar 2017 From:[email protected] To:[email protected] Message-ID:<10091223> Subject:Symphony echo X-SUBTYPE=RETURES x-globalrelay-MsgType: XXXX x-StreamType:xxxx x-contentstartdate:XXX < Yay1R0QgoH.............. as shown above after executing the script the html tags at the begining are missing i am not able to find out why....can any one help me with thisHi You GOT an answer here, so check it !
|