• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

BLAT contents of file as subject line

I am looking for a way to blat the contents of a file as the subject line.  Currently the contents are appearing in the body using:

blat <filename> -to...

1 Solution
This batch file will accept a file name and take the first line and use it as the subject. You'll want to change the -to part. Also, I just echo out the blat command. To enable it remove echo.

@echo off

if "%~1"=="" echo Please enter file name on the command line.&goto :EOF
if not exist "%~1" echo %1 does not exist.&goto :EOF

for /f "delims=" %%a in ('type "%~1" 2^>NUL') do set subject=%%a&goto STOP


REM ** Remove echo and change to part
echo blat "%~1" -subject "%subject%" -to somebody@somewhere.com

Good Luck,

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now