I have this file C:\Meniscus\Xml\cc_debug.txt that contain
Code: Select all
<msg><src>CC128-v0.11</src><dsb>01598</dsb><time>09:56:48</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00271</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01598</dsb><time>09:56:54</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00269</watts></ch1></msg>
<msg><src>CC128-v0.11</src><dsb>01598</dsb><time>09:57:00</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00270</watts></ch1></msg>
My goal is to create a new file with put head each record a string "<MenTime>28/09/2014 09:41:04</MenTime>" and get this result
Code: Select all
<MenTime>28/09/2014 09:56:48</MenTime><msg><src>CC128-v0.11</src><dsb>01598</dsb><time>09:56:48</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00271</watts></ch1></msg>
Here my code
Code: Select all
echo off
set /a record=0
call :routine_ora
:start
echo %file_upd%
for /F %%a in ('tail -n1 C:\Meniscus\Xml\cc_debug.txt') do set MENISCUS="%%a"
echo ^<MenTime^>%date% %DateTime2:~9,2%:%smm1%:%sss1%^</MenTime^>%MENISCUS%
rem echo ^<MenTime^>%date% %DateTime2:~9,2%:%smm1%:%sss1%^</MenTime^>%MENISCUS%
echo ^<MenTime^>%date% %DateTime2:~9,2%:%smm1%:%sss1%^</MenTime^>%MENISCUS% >> "C:\Meniscus\Ftp\CurrentCost\%file_upd%"
set /a record=%record%+1
if "%record%"=="20" call :routine_ora
sleep 6
goto:start
goto:eof
:routine_ora
SET start=%time%
SET shh1=%start:~0,2%
SET smm1=%start:~3,2%
SET sss1=%start:~6,2%
FOR /f "tokens=1-7 delims=/.: " %%a in ("%date% %shh1%:%smm1%:%sss1%") do (set "H=0%%d" &call set "DateTime2=%%a%%b%%c_%%H:~-2%%%%e%%f")
set file_upd=ixwphysn_%DateTime2%
goto:eof
But my result is this (with quote)
<MenTime>28/09/2014 09:56:48</MenTime>"<msg><src>CC128-v0.11</src><dsb>01598</dsb><time>09:56:48</time><tmpr>23.1</tmpr><sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00271</watts></ch1></msg>"
But if I remove quote here
Code: Select all
set MENISCUS="%%a"
How can I resolve this problem?
Thanks in advance