A
A
Anton2021-09-20 13:56:37
Windows
Anton, 2021-09-20 13:56:37

How can I send the last n lines from the logs by mail?

Hello.
Tell me how in windows 10 you can take the last n lines from the replenished .txt file and send it by mail?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Bezrukov, 2021-09-20
@hunk3r

PowerShell:

$res = Get-Content -Tail 10 "FullPathToFile"
Send-MailMessage -From "Sender" -To "Recipient" -Body $res -SMTPServer "SmtpServer"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question