在生成的html文件中,ping结果的输出被破坏了。我希望结果显示为$ ping。
$ ping = Ping 192.168.1.1
Convertto-html -body $ ping | out-file ping.html
答案 0 :(得分:0)
这是一个小黑客,但试试这个:
$ping = (ping 192.168.1.1) -replace "<", "<"
(ConvertTo-Html -Body $ping) -replace "<body>", "<body>`n<pre>" `
-replace "<table>", "</pre>`n<table>" | Out-File "ping.html"