Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for emaillog.bat

(view source code of emaillog.bat as plain text)

  1. @ECHO OFF
  2. FOR /F "TOKENS=*" %%A IN (LOGFILE.LOG) DO CALL :AddLine %%A
  3. :: The ":~6" in "%BODY:~6%" removes the "%0D%0A" at the start of the body
  4. START mailto:sysadm@ourdomain.com?subject=Log%%20file^&body=%BODY:~6%
  5. GOTO :EOF
  6.  
  7. :AddLine
  8. SET LINE=
  9. FOR %%Z IN (%*) DO CALL :AddWord %%Z
  10. :: The ":~3" in "%LINE:~3%" removes the "%20" at the start of the line
  11. SET BODY=%BODY%%%0D%%0A%LINE:~3%
  12. GOTO :EOF
  13.  
  14. :AddWord
  15. SET LINE=%LINE%%%20%1
  16. GOTO :EOF
  17.  

page last uploaded: 2017-08-21, 14:26