如何使用批处理将日期和时间写入同一行的日志文件

How to write date and time to a log file on the same line using batch

我目前正在制作 to write the date and time to a ,但我无法找到如何将信息保持在 .log 的同一行。

REM Clear the screen
REM ------------------------------------------------------
cls


date /T >> C:\myTemp\devTracker.log 
time /T >> C:\myTemp\devTracker.log 


ECHO Starting Microsoft Visual Studio...

您可以使用预定义的 %date%%time% 变量从批处理文件访问当前日期和时间,而无需调用 date.exetime.exe。只需使用 echo.

将它们直接写入日志文件即可
echo %date% %time% >> C:\mytemp\devtracker.log