Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
VB
function schedule(date,time,Filename)
	 
		strComputer = "."
			Set objWMIService = GetObject("winmgmts:" _
    				& "{impersonationLevel=impersonate}!\\" _
  					& strComputer & "\root\cimv2") 
		JobID = "Test"
		Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
		errJobCreate = objNewJob.Create _
    			("cmd /c cscript D:\New Folder\To send the Mail\Mail.vbs",time, _
        		false , ,date,True, JobId) 
		If errJobCreate = 0 Then
			objfilelog.writeline( Name  & vbtab &  vbtab & vbtab & "success"  & vbtab & vbtab &  now() & vbtab & JobId )
    			
		Else
    			
			objfilelog.writeline( Name  & vbtab & vbtab & "Failed" & vbtab & errJobCreate  )
		End If

	end function




Mail.vbs content

'**************************Script to send the status of the SFTP Service**************

VB
Dim sBlat,oExecObject,oshell

 	Set oShell = CreateObject("WScript.Shell")
		
		'sBlat="C:\IST\Utils\Blat """ & "FIlename"" to ""mail id"""
	 
		sBlat="C:\IST\Utils\Blat """ & "Filename"" -to ""mail id"""
		
		sBlat=sBlat & " -s ""Test "

		'sBlat=sBlat & """ -cc ""mail id"
		sBlat=sBlat & """ -p psupport"
		'msgbox (sBlat)
				'Alert sBlat
				Set oExecObject = oShell.Exec(sBlat)
				Set oshell=Nothing
				Set oExecObject = Nothing
Posted
Updated 22-Jan-14 4:37am
v4

1 solution

Take a look at the links here:

A small google search looking for: call a vbscript from vbscript with parameters has made it.

Now seriously you should have tried to search for it. Clicking this link will take you directly to the google search through Let Me Google That For You: http://bit.ly/1d4ZVRH[^].

The first results come with examples.
 
Share this answer
 
Comments
Member 10525881 20-Jan-14 7:15am    
I am trying to schedule the second script from first one and I already have tried the way you suggested.
please help me, if you have any other ideas.
Joan M 20-Jan-14 9:17am    
This is a vague comment: what have you tried?
I can see the 3 first results of the proposed Google search as perfect answers to your question.
Which of those results have you tested, why are they failing, could you update the question to get a proper answer from any CPian...

Keep in mind we can't read minds through our DSLs... you should be as clear as possible to get any positive answer...
Member 10525881 22-Jan-14 10:40am    
I want to pass the file name from the first script to the mailing script .
Is it ok with you or you want more details about the problem
Joan M 25-Jan-14 6:10am    
You are the one that needs help, therefore, if somebody asks you extra information and a little bit more of explanation after giving you several examples of how to get it done, the last you could do is giving that extra information...

Take a look here: http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/25/how-can-i-send-data-from-one-script-to-another.aspx
and here: http://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx
Which are the 4th and 5th result of the google search I sent you.

If that is not giving you enough help, then extending your question and adding an exact explanation of your needs (and not only two code snippets) will probably give you better results. What you want to send from the first script to the second one, what have you tried...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900