PSObject to ConvertTo-Html与标题? [英] PSObject to ConvertTo-Html with header?

查看:80
本文介绍了PSObject to ConvertTo-Html与标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下PowerShell脚本生成 * 作为列头。为什么不 XXX

The following powershell script generates * as the column head. Why not XXX?

$a = "a","b","c"
$a | select -Property @{Name="XXX"; Expression={$_}} | ConvertTo-Html

如何将列头设置为XXX?

How to make the column head to "XXX"?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML TABLE</title>
</head><body>
<table>
<colgroup><col/></colgroup>
<tr><th>*</th></tr> <!--- <------ * ----->
<tr><td>a</td></tr>
<tr><td>b</td></tr>
<tr><td>c</td></tr>
</table>
</body></html>


推荐答案

这显然是一个已知问题,版本的PowerShell和从未修复:

This is apparently a known issue that was introduced in newer versions of powershell and never fixed:

https://social.technet.microsoft.com/Forums/windowsserver/en-US / 588275ba-1b3a-42af-b59c-20264b25ff99 / converttohtml-shows-in-html-table-column-header?forum = winserverpowershell

这篇关于PSObject to ConvertTo-Html与标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆