Skip to content

Instantly share code, notes, and snippets.

@jaka
Created February 16, 2021 18:59
Show Gist options
  • Save jaka/2df59394ee2626b1c5b173cca94c34bb to your computer and use it in GitHub Desktop.
Save jaka/2df59394ee2626b1c5b173cca94c34bb to your computer and use it in GitHub Desktop.
Quick & dirty batch file for logging with digitemp.exe on Windows
@echo off
::
SET LOGDIR=logs
:: generate log filename
SET filedate=%DATE:~-4,4%_%DATE:~-7,2%_%DATE:~-10,2%
SET filetime=%TIME:~0,-3%
SET filetime=%filetime::=_%
SET filename=%LOGDIR%\%filedate%_%filetime%.log
IF EXIST %LOGDIR% GOTO checkexe
MKDIR "%LOGDIR%" && echo Created directory for log
:checkexe
IF EXIST digitemp.exe GOTO checkcfg
echo digitemp.exe is missing.
GOTO :EOF
:checkcfg
IF EXIST digitemp.cfg GOTO logging
echo digitemp.cfg is missing, run digitemp.exe -i to create a configuration file.
GOTO :EOF
:logging
echo Starting logging at %DATE% %TIME% to %filename%
:loop
digitemp.exe -a -q -o%D,%T,%C >>"%filename%"
GOTO loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment