SharpeRAD / Cake.Powershell

Powershell addin for Cake
http://cakebuild.net
MIT License
83 stars 36 forks source link

How to transfer cake variable to powershell script's body? #11

Closed constructor-igor closed 7 years ago

constructor-igor commented 7 years ago

Script

var reportFilePath = MakeAbsolute(File("report.html")).ToString();
StartPowershellScript("$Outlook = New-Object -ComObject Outlook.Application\n$Mail = $Outlook.CreateItem(0)\n$Mail.To = 'igor@test.com'\n$Mail.Subject = 'report'\n$Mail.Body = 'body'\n$Mail.Attachments.Add(reportFilePath)\n$Mail.Send()");

failed with error: image

SharpeRAD commented 7 years ago

The ReadMe includes examples of using arguments but since your executing a powershell script (string) you could just append the filePath to it.