batch file - How to send wild card attachment? -
this batch file (date.bat
) copy file based on current date new folder:
copy c:\test\output.csv c:\test2\output%date:~-4,4%_%date:~-10,2%_%date:~7,2%.csv
this email.vbs
script send attachment user:
set objmessage = createobject("cdo.message") objmessage.subject = "test123" objmessage.from = "spartan@test.com" objmessage.to = "test123@test.com" objmessage.htmlbody = strhtml objmessage.addattachment "c:\test\output.csv" '==this section provides configuration information remote smtp server. '==normally change server name or ip. objmessage.configuration.fields.item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'name or ip of remote smtp server objmessage.configuration.fields.item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "spartan-dev" 'server port (typically 25) objmessage.configuration.fields.item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objmessage.configuration.fields.update '==end remote smtp server configuration section== objmessage.send
what want execute date.bat
on friday, , send friday's attachment on next monday.
use task scheduler.
this shows how connect computer , lists tasks in root folder.
set ts = createobject("schedule.service") ts.connect("serenity") set rootfolder = ts.getfolder("\") set tasks = rootfolder.gettasks(0) if tasks.count = 0 wscript.echo "no tasks registered." else wscript.echo "number of tasks registered: " & tasks.count each task in tasks a=task.name = & " " & task.nextruntime = & " " & task.lasttaskresult wscript.echo next end if
you can use batchfile. see schtasks /?
.
this listing files in folder.
set fso = createobject("scripting.filesystemobject") set f = fso.getfolder("c:\") set fc = f.files each f1 in fc s = s & f1.name next msgbox s
Comments
Post a Comment