@echo off :start git checkout . git pull For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b) echo %mydate%_%mytime% > lastreboot.txt node bot.js >> currentlog.txt echo She ded. Restarting. ren currentlog.txt crashlog.txt goto :start