I need to merge 2 script but I'm in big trouble with variable, I hope you give me right solution
Basically this 2 scripts access to same information "cc_debug.txt" at same time, so it's better merge it
I try to do it, but I can't solve problem of variable I also use a ! because of delay but doesn't work, 3 script it's my merge.
Thanks in advance and regards
First script
Code: Select all
echo off
setlocal enableDelayedExpansion
set /a record=-1
set /a FTPrecord=0
for /l %%# in () do (
set /a "1/((record+=1)%%20)" 2>nul || (
for /f "tokens=1-6 delims=/,.: " %%A in ("!date! !time: =0!") do (
set "MenTime=<MenTime>%%A/%%B/%%C %%D:%%E:%%F</MenTime>"
set "file_upd=C:\Meniscus\Ftp\ixwphysn_%%A%%B%%C_%%D%%E%%F"
)
set /a FTPrecord=!FTPrecord!+1
if "!FTPrecord!"=="5" (
move /Y C:\Meniscus\Ftp\* C:\Meniscus\Ftp\send\
set /a FTPrecord=0
SchTasks /Run /tn "\Current_Cost_cc128\FTP Meniscus"
)
)
for /f %%A in ('tail -n1 C:\Meniscus\Data\cc_debug.txt') do (
>>"!file_upd!" echo !MenTime!%%A
)
sleep 6
)
Second script
Code: Select all
@echo off
:start
for /F %%a in ('tail -n1 C:\Meniscus\Data\cc_debug.txt ^| find "<watts>"') do call set RIGA="%%a"
set TEMP=%RIGA:~71,4%
set WATT=%RIGA:~140,5%
"C:\Current_Cost_Dos\DB\rrdtool" update "C:\Current_Cost_Dos\DB\powertemp.rrd" N:%WATT%:%TEMP%
"C:\Current_Cost_Dos\DB\rrdtool" update "C:\Current_Cost_Dos\DB\power1temp1.rrd" N:%WATT%:%TEMP%
sleep 6
goto:start
third script
Code: Select all
echo off
setlocal enableDelayedExpansion
set /a record=-1
set /a FTPrecord=0
for /l %%# in () do (
set /a "1/((record+=1)%%20)" 2>nul || (
for /f "tokens=1-6 delims=/,.: " %%A in ("!date! !time: =0!") do (
set "MenTime=<MenTime>%%A/%%B/%%C %%D:%%E:%%F</MenTime>"
set "file_upd=C:\Meniscus\Ftp\ixwphysn_%%A%%B%%C_%%D%%E%%F"
)
set /a FTPrecord=!FTPrecord!+1
if "!FTPrecord!"=="5" (
move /Y C:\Meniscus\Ftp\* C:\Meniscus\Ftp\send\
set /a FTPrecord=0
SchTasks /Run /tn "\Current_Cost_cc128\FTP Meniscus"
)
)
for /f %%A in ('tail -n1 C:\Meniscus\Data\cc_debug.txt') do (
>>"!file_upd!" echo !MenTime!%%A
set RIGA="%%a" or set "RIGA=%%a"
set TEMP=%RIGA:~71,4% or set TEMP=!RIGA:~71,4!
set WATT=%RIGA:~140,5% or set WATT=!RIGA:~140,5!
"C:\Current_Cost_Dos\DB\rrdtool" update "C:\Current_Cost_Dos\DB\powertemp.rrd" N:%WATT%:%TEMP%
"C:\Current_Cost_Dos\DB\rrdtool" update "C:\Current_Cost_Dos\DB\power1temp1.rrd" N:%WATT%:%TEMP%
)
sleep 6
)