加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

批处理读文件,perl 发送邮件 ,access 导出 csv

发布时间:2020-12-15 21:05:13 所属栏目:大数据 来源:网络整理
导读:都是工作中遇到的问题,记下来以免以后要用到: 1 批处理读文件: set /p MString=filename.txt echo %MString% 此代码只读入一行 2 将access的query 导出为csv Function exportDetail(QueryName As String) ?Dim time As String ?Dim tmp As String ? ?time
都是工作中遇到的问题,记下来以免以后要用到: 1 批处理读文件: set /p MString=<filename.txt echo %MString% 此代码只读入一行 2 将access的query 导出为csv Function exportDetail(QueryName As String) ?Dim time As String ?Dim tmp As String ? ?time = Format(Now(),"General Date") ?tmp = Replace(Replace(time,"/","_"),":","_") ?curpath = Environ("workPath") ?filenamestr = curpath & "" & QueryName + "_" + tmp & ".csv" ?Dim str As String str = QueryName + "_" + tmp & ".csv" Open curpath & "" & "filename.txt" For Output As #1 ? Print #1,str Close #1 DoCmd.TransferText TransferType:=acExportDelim,_ TableName:=QueryName,FileName:=filenamestr,HasFieldNames:=True End Function 3 Perl发送邮件(带附件) #! /usr/local/bin/perl -w ? use Mail::Sender; #command line parameters my $to?????? = $ARGV[0]; my $subject? = $ARGV[1]; my $file???? = $ARGV[2]; #my $today_ = `date /t 2>&1`; #chomp ($today_); #get the correct number of args sub validateArgs(@) { ?? $argSize = @ARGV; ?? if ($argSize < 3) { ????? print "You must enter 3 parameters:? "to" "subject" filename n"; ????? exit 101; ?? } } sub mail{ ref ($sender = new Mail::Sender { from => '发件人',????? smtp => 'na.relay.ibm.com',boundary => 'This-is-a-mail-boundary-435427'}) or die "Error($sender) : $Mail::Sender::Errorn"; ? $sender->OpenMultipart({to => $to,??????????????????????? subject => $subject}); $sender->Body; $sender->SendEnc(<<'*END*'); Attachment is test! *END* $sender->Attach( ?{description => 'test',? ctype => '',? encoding => '',? disposition => '',? file => $file ?}); $sender->Close; } #MAIN select STDERR; $| = 1; select STDOUT; $| = 1; validateArgs(@ARGV); mail(); exit(0);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读