• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 505
  • 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,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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