我有一个 vbscript,它将文件夹内容作为附件发送到我的电子邮件,但问题是我无法指定 windows 文件夹的路径,因为不同计算机的 windows 路径不同。
在我的代码中,以下作品
Const PATH = "C:\windows\Folder1\"
但由于不同机器的路径不同。我尝试关注但没有成功
Const PATH = "%windows%\Folder1\"
这是完整的 vbscript 代码
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Set objMessage = CreateObject("CDO.Message")
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFolder
Dim oFile
Dim oFiles
Const PATH = "%windows%\Folder\" 'This method not working!!!!!
Set oFolder = fso.GetFolder(PATH)
Set oFiles= oFolder.files
objMessage.Subject = "This is the email subject"
objMessage.From = "mailSender@MyMail.com"
objMessage.To = ""
objMessage.TextBody = "This is the body of the email. I’m fairly unoriginal"
For Each oFile in oFolder.files
objMessage.AddAttachment PATH & oFile.name
Next
'==This section will provide the configuration information for the remote SMTP server.
'==End remote SMTP server configuration section==
objMessage.Send
当远程 SMTP 服务器的配置信息代码完美运行时。
我将如何在此脚本中指定窗口、程序文件、桌面(特殊文件夹)?