Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript Called by Batch File in Command Task does not work

Status
Not open for further replies.

r0mmelforums

Technical User
Jan 18, 2012
1
US
Hi Everyone,
I have a Windows batch file in a command task that calls a VBScript. It is working when I run the batch file manually, but when I run it through the command task, it doesn’t work. It just keeps running and does not stop.

Here’s my batch file (cmdSendEmail.bat):

Code:
C:\PowerCenter_Scripts\sendmailattachment.vbs


And here’s my VBScript (sendmailattachment.vbs):
Code:
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
'objMailItem.Display
strEmailAddr  = "my.email@company.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Subject = "Test Email from PowerCenter"
objMailItem.Body = "Hi, this is only a test."
objMailItem.Attachments.Add "C:\PowerCenter_Output_Files\file.csv"
objMailItem.Send
Set objMailItem = nothing
Set objOutl = nothing
Wscript.Quit

Hope you guys could help me. I’ve been clueless for days.

Regards,
r0mmel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top