|Thanks for quick reply :)|
I've done this ... but my requirement is a bit more ... which is failing cos of the two do loops (i.e. do loop inside a do loop)
Below is the logic
As described above, we have a text file where a list of the Domain ID, user names & their respective email id's are stored (ideally 5-7 rows)
For each row we need to fire an email ... this is email has list of all the files that are checked-out by that particular users and for which we create dynamic emails and send them one by one
In my example I've two unique rows ... but it still sends two email to the first user ... Do I need to store the second do loop values again in another variable set outside the loop?
Below is the code:
for /f "tokens=1,2,3 delims=," %%a in (NotifyGroup.txt) do (
Call :SetNotifyVar %%a %%b %%c
:: @echo off & setlocal
:: set the temp file location
:: echo the basic headers to the temp file
echo To: "VSS Middle Tier-USER" ^<%email%^> > %tempmail%
echo From: "Admin" ^<email@example.com^> >> %tempmail%
echo Subject: Checked-Out File/s Status >> %tempmail%
cd "Program Files\Microsoft Visual Studio 9.0\Common7\IDE\"
tf status /s:server /user:%hqdomain%>>"C:\Documents and Settings\NotifyCheckedOutStatus\%user%.txt"
:: echo the blank line that separates the header from the body text
:: echo the body text to the temp file
echo %user%,>> %tempmail%
:: here I need to change directory cos the batch files are lying in this folder
cd "Documents and Settings\NotifyCheckedOutStatus"
for /f "tokens=*" %%d in (%user%.txt) do (
echo !filecontent!>> %tempmail%
:: delete the file
:: move the temp file to the mail pickup directory
:: adjust this location for your system
move %tempmail% c:\inetpub\mailroot\pickup