我一直在尝试使用批处理文件和VBS脚本为Windows上的VisualSVN服务器编写一个后锁定挂钩。最终目标是让挂钩电子邮件将所有锁定文件的列表发送到电子邮件地址集合。但是,为每个文件调用钩子。我希望有一种解决方法,或者在发送电子邮件之前等待所有信息的巧妙方法。此外,我想要一个所有文件的列表,但目前只传递了repo路径。我知道文件路径是通过stdin传递的,但我还没有找到一种方法将它传入一个字符串传递给我VBS文件。任何帮助都会很棒。
批处理文件:
@echo off
pushd %~dp0
cscript email-bat.vbs %2 LOCKED %1
@pause 5
VBS:
Set emailObj = CreateObject("CDO.Message")
Set args = WScript.Arguments
emailObj.From = "mymail@gmail.com"
emailObj.To = "tomail@gmail.com"
emailObj.Subject = "SVN " + args.Item(1)
emailObj.TextBody = args.Item(0) + " has " + args.Item(1) + " the file(s) " + args.Item(2) + "."
Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mymail@gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
emailConfig.Fields.Update
emailObj.Send