[英]How to append the data in the log file when the batch file is executed
I wanted to append the contents of the log file when i ran batch file often, code im using in batch file to create a log file which contains data present in the console is call test1.bat >logfile.log 2>&1 This only create the log file once and will not delete or append the data in the log file.. Please help me out to solve this issue. 当我经常运行批处理文件时,我想附加日志文件的内容,代码im在批处理文件中使用以创建包含控制台中存在的数据的日志文件,称为test1.bat> logfile.log 2>&1仅此创建日志文件一次,并且不会删除或将数据附加到日志文件中。请帮助我解决此问题。 this is the content of the file
这是文件的内容
@echo off
CD /D %~dp0
set day=-1
echo >"%temp%\%~n0.vbs" s=DateAdd("d",%day%,now) : d=weekday(s)
echo>>"%temp%\%~n0.vbs" WScript.Echo year(s)^& right(100+month(s),2)^& right(100+day(s),2)
for /f %%a in ('cscript /nologo "%temp%\%~n0.vbs"') do set "result=%%a"
del "%temp%\%~n0.vbs"
set "YYYY=%result:~0,4%"
set "MM=%result:~4,2%"
set "DD=%result:~6,2%"
set "data=%yyyy%-%mm%-%dd%"
echo Yesterday was "%data%"
set year=%data:~0,4%
set month=%date:~4,2%
set day=%data:~8,3%
set filename=Login_%year%-%month%-%day%.log.gz
echo Filename = %filename%
C:\wamp\bin\php\php5.3.9\php.exe C:\wamp\www\F\csv\index.php
call test1.bat >>logfile.log 2>&1
pause
call test1.bat >>logfile.log 2>&1
像每一个壳>>
是appending.Check也是这个 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.