我已经完成了要发送邮件的命令Powershell
。这是我的代码
powershell.exe
$user="username@gamil.com"
$pass=cat I:\password.txt | convertto-securestring
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist $user, $pass
send-MailMessage -SmtpServer smtp.gmail.com -Credential $mycred -Usessl true -From 'username@gamil.com' -To 'usernametwo@gamil.com' -Subject 'failure Test'
当我在命令提示符下执行时,上面的代码工作正常,但当我尝试创建.bat
文件时却不行。我用代码做了什么问题?