Тема: VBS: Путь к %windir% при отправке файла на e-mail
Доброго времени суток! Есть скрипт отправки файла на e-mail. При прописывании пути: iMsg.AddAttachment " C:\WINDOWS\TEST.TXT" - файл отсылается. Хотелось-бы прописать:iMsg.AddAttachment " %windir%\TEST.txt
Код:
set FSO = CreateObject("Scripting.FileSystemObject")
Set WSHshell = WScript.CreateObject("WScript.Shell")
Set sDir = WSHshell.Environment("Process") ' - находим путь к папке Windows
'================================================= ================================================== ============
set FSO=createobject("scripting.filesystemobject")
Call SendPost("smtp.mail.ru","*********77@mail.ru","**********ez@mail.ru","Инфо","**********")
Function SendPost(strSMTP_Server,strTo,strFrom,strSubject,strBody)
Set iMsg=CreateObject("CDO.Message")
Set iConf=CreateObject("CDO.Configuration")
Set Flds=iConf.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="*********ez@mail.ru"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="*********"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.mail.ru"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
Flds.Update
iMsg.Configuration=iConf
iMsg.To=strTo
iMsg.From=strFrom
iMsg.Subject=strSubject
iMsg.TextBody=strBody
iMsg.AddAttachment " "windir"\TEST.TXT"
iMsg.Send
End Function
Set iMsg=Nothing
Set iConf=Nothing
Set Flds=Nothing
Происходит ошибка:
Строка: 24
Символ: 23
Ошибка: Предполагается наличие окончания инструкций
код: 80A0401
P.S. Гуглил,читал, экспериментировал - но победить не смог(в языках программирования полный ноль)

