有没有办法使用Read-Hostcmdlet 捕获多行?
我目前的方法有点尴尬(并且实际上不起作用):
PS> Send-MailMessage -SmtpServer 'smtp.domain.xxx' -From 'First Last <flast@domain.xxx>' -To 'First Last <first.last@company.com>' -Subject 'Testing' -Body (Read-Host 'Enter text')
Enter text: line one `n line two `n line three
Run Code Online (Sandbox Code Playgroud)
生成的电子邮件正文不是三行:
line one `n line two `n line three
$x = while (1) { read-host | set r; if (!$r) {break}; $r}
Run Code Online (Sandbox Code Playgroud)
空行结束输入。
| 归档时间: |
|
| 查看次数: |
7323 次 |
| 最近记录: |