Here is a Windows batch script to append a passed line of text to the specified file (prepending the text with a date/time stamp). The idea is to use it to capture your day’s activities in a daily log format. It’s especially useful when combined with a tool like Launchy.

@echo off
setlocal

set MYDOCSPATH=[replace]
set LOGSUBPATH=[replace]
set FILENAME=DailyLog
set FILEEXT=txt

:: Generate date/time stamp
for /F "tokens=1 delims=/ " %%G in ('echo %DATE%') do set WEEKDAY=%%G
for /F "tokens=2 delims=/ " %%G in ('echo %DATE%') do set MONTH=%%G
for /F "tokens=3 delims=/ " %%G in ('echo %DATE%') do set DAY=%%G
for /F "tokens=4 delims=/ " %%G in ('echo %DATE%') do set YEAR=%%G
set YMD=%YEAR%%MONTH%%DAY%
for /F "tokens=1 delims=:." %%G in ('echo %TIME%') do set HOUR=%%G
for /F "tokens=2 delims=:." %%G in ('echo %TIME%') do set MIN=%%G
for /F "tokens=3 delims=:." %%G in ('echo %TIME%') do set SEC=%%G
if %HOUR% LSS 10 set HOUR=0%HOUR%
set HMS=%HOUR%%MIN%%SEC%
set DATETIMESTAMP=%YMD%-%HMS%

set LOGFILE=%MYDOCSPATH%\%LOGSUBPATH%\%FILENAME%.%FILEEXT%
set MESSAGE=%WEEKDAY% %YEAR%-%MONTH%-%DAY% %HOUR%:%MIN%:%SEC% \\ %*
if "%*"=="" (
echo No log message provided.  Displaying contents of log file.
) else (
echo Writing log message: %*

echo %MESSAGE% >> "%LOGFILE%"
)
echo ----------------------------------------------------------------------
type "%LOGFILE%"
echo ----------------------------------------------------------------------
pause

endlocal

Creating a Front-End Build Template, Part 1

For a long time I've avoided getting into any "serious" front-end development work... by which I mean, of course, JavaScript (_shudder_)....… Continue reading

Marvel Cinematic Universe Viewing Order

Published on December 14, 2014

Mercurial Rebase with TortoiseHg

Published on May 29, 2014