Make batch file with powershell script
I have done the commands that I want to send mail in Powershell . This is my code 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' Above code is working fine when I execute in command prompt, but not When I try to make a .bat file. What is the problem I have done with code? Remove powershell.exe