read text file and assign value

January 20, 2010 at 09:13:35
Specs: Windows XP

I have a email.dat file with several lines of email ids. I want to have batch file (myfile.bat) which will read email.dat and give me the email ids in a one single variable. I have to use this variable in the email To: parameter. I have email code but it is now hardcoded. I want to retieve the email ids from email.dat

See More: read text file and assign value

Report •

January 20, 2010 at 12:11:32
Can you post a sample of your email.dat, just the top 5 lines, so that we can see how it is formatted?

Report •

January 20, 2010 at 12:28:43
--------------, SMITH JONES, YU GALE

A change in my inital request is that I want to collect this email in a variable and use it in the BCC. I don't want the people in the list to know each other.

The other issue i have is as you can see these email IDs are outside my corporate ids. I am able to send emails to inside ids but not to the outside world. I know this is not for this forum but any pointers is much appreciated.


Report •

January 21, 2010 at 08:43:13
Here you go...

@echo off
for /f "tokens=1,2 delims=, " %%a IN (email.dat) DO (
  call :setvar %%a)
goto :eof

set BCC=%BCC%;%1
goto :eof

It sets a system variable BCC. You can Echo %BCC% to make sure it is formatted right.

Report •

Related Solutions

January 21, 2010 at 09:08:30
thanks so much. I am pretty sure this will help me.

Report •

January 21, 2010 at 09:09:26
sorry i alsomeant to reply...Not have th code handy... :)


Report •

Ask Question