i try to append the current date and time in the filename of my log file. it's working very well but only from 10:00:00 am never before and i did not try when it stops to work maybe at 00:00:00 i don't know.
how can i resolve this problem, please?
Here is the batch file:
echo off
cls
date /t >> d:\Folder_Log\log.txt
time /t >> d:\Folder_Log\log.txt
echo Starting execution >> d:\Folder_Log\log.txt
java -jar d:\NetBeansProjects\myapplication\dist\myapplication.jar 2>> d:\Folder_Log\log.txt
echo Finished execution >> d:\Folder_Log\log.txt
:: Writing log file in D:\Folder_Log\Log.txt***********************************************************
Timeout /t 3 /nobreak >nul
ren d:\Folder_Log\log.txt-log-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.txt
Thank you
If the hour is less than 10, then you get a space in your name. Names with spaces must be quoted.
ren "d:\Folder_Log\log.txt" "log-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.txt"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With