hi everyone,
i am calling many batch file from one batch file.
the one batch file from which i am calling other batch files contains this
echo %DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2% %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% Starting the 1st process...!
2nd process...!
nth process...!
what happens here is windows calculates this value only first time and prints same value every time.
and i am using that echo statement for 20 times.
so 20 times same time stamp gets printed.
and i am not able to see what time is taken by which process.
so i want the updated time and date for every process.
i want this pattern 2012-05-15 13:59:01.
i even stored it in a variable and tried to print....but i got same output...!
any suggestions?
thank you.
Date And Time not getting Updated....!
Moderator: DosItHelp
Re: Date And Time not getting Updated....!
Use delayed expansion.
Re: Date And Time not getting Updated....!
how?
will it get updated?
because i am using that for 20 times
will it get updated?
because i am using that for 20 times
Re: Date And Time not getting Updated....!
Try this:
Code: Select all
@echo off
setlocal EnableDelayedExpansion
(
echo !time!
ping -n 10 localhost >nul
echo !time!
)
pause
Re: Date And Time not getting Updated....!
it worked.
thnks foxidrive...!
thnks foxidrive...!
Re: Date And Time not getting Updated....!
prash11,
Kind of the same thing as your previous thread. '
viewtopic.php?f=3&t=3297
Do you understand now when you have to use delayed expansion?
Kind of the same thing as your previous thread. '
viewtopic.php?f=3&t=3297
Do you understand now when you have to use delayed expansion?