Solved Passing Parameters from batch script to a VBS script

October 25, 2013 at 06:59:46
Specs: Windows Server 2003
Please help me on below,

My batch script contains : Im passing this parametrs to the subject of the email

cscript email.vbs %cap1%

My Vbs email.vbs:

dim ArgObj, a
Set fso = CreateObject("Scripting.FileSystemObject")
Set ArgObj = WScript.Arguments
a = ArgObj(0)

Const SMTPServer = "mailo2.uhc.com"
Const Recipient = "Suhail_Abbas@uhc.com"
Const From = "no_reply@uhc.com Facets Unison/GLHP Batch Team"
Const Subject = &a&
Const Message = "THe Batch Failed with a Return Code of 8 and custom error code 8."

GenericSendmail SMTPserver, From, Recipient, Subject, Message

-----------------
-----------------

Im getting error in the above script. When i used like "&a&", the Subject is coming as &a&

Please provide your inputs on this.


See More: Passing Parameters from batch script to a VBS script

Report •


#1
October 25, 2013 at 08:00:15
Replace:
Const Subject = &a&
With:
Subject = a

How To Ask Questions The Smart Way


Report •

#2
October 25, 2013 at 09:16:15
Thanks Razor.. It working fine but I have two words in the Variable %cap1%
cscript email.vbs %cap1%
Its capturing only first word

How could i modify vbs script for below

cscript email.vbs Job Success


message edited by suhailabbas


Report •

#3
October 25, 2013 at 10:18:48
✔ Best Answer
cscript email.vbs "%cap1%"
 

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
October 25, 2013 at 10:32:28
Thanks a lot.. Itw working fine :)

Report •

Ask Question