AlbertGM
November 20th, 2006, 12:21 PM
Hi,
I'd need a way to know date and time inside a .BAT o .CMD, save into a variable and write a file with that name.
I call an application (.EXE) from a batch script. If applications fails it returns me an error code which I can catch using ERRORLEVEL. Then I can restart the application again, but I'd like to know when that has happened. My script is like this:
@echo off
:start
Application.exe
if ERRORLEVEL 1 goto err_label
goto exit_label
:err_label
echo "There's an error... Restart" >> error.txt
goto start
:exit_label
echo "Exit success" >> ok.txt
goto end
:end
And instead ofecho "There's an error... Restart" >> error.txtI'd like something like:
echo "There's an error... Restart" + Date + Time >> error.txt
How Can I do that?
Thanks in advance!
I'd need a way to know date and time inside a .BAT o .CMD, save into a variable and write a file with that name.
I call an application (.EXE) from a batch script. If applications fails it returns me an error code which I can catch using ERRORLEVEL. Then I can restart the application again, but I'd like to know when that has happened. My script is like this:
@echo off
:start
Application.exe
if ERRORLEVEL 1 goto err_label
goto exit_label
:err_label
echo "There's an error... Restart" >> error.txt
goto start
:exit_label
echo "Exit success" >> ok.txt
goto end
:end
And instead ofecho "There's an error... Restart" >> error.txtI'd like something like:
echo "There's an error... Restart" + Date + Time >> error.txt
How Can I do that?
Thanks in advance!