您好我写了一个简单的脚本,用于在html中输出quickfixengineering,但有些事情并不令人满意。
$qfe = gwmi -class win32_quickfixengineering
$qfe | select-object -property HotFixID, Description, Caption,
@{LABEL="URL"; EXPRESSION={ "<a href=""" + $_.caption + """>" + $_.caption + "</a>" } } |
ConvertTo-html -Head $style -body "<H2>Windows Update Information (quickfixengineering)
</H2><H3>Creation Date: $date / Entries found: $fixcount</H3> " |
Out-File $scriptpath\html\$file
我的想法是在将标题转换为html之前将标题属性放在html链接标记中, 但是当它被实际转换时,某些字符会被转换为html字符代码。
像这样:<a href="http://go.microsoft.com/fwlink/?LinkId=133041">http:
//go.microsoft.com/fwlink/?LinkId=133041</a>
我尝试了几件事。 ''人物也不是真正帮助我(不知道如何用英语称呼这些)。如果事情不够实际,那么这些使得它更加文字。
有没有人有想法/可以帮我解决这个问题:) tnx
答案 0 :(得分:2)
在保存前尝试解码:
$qfe = gwmi -class win32_quickfixengineering
$html = $qfe | select-object -property HotFixID, Description, Caption,
@{LABEL="URL"; EXPRESSION={ "<a href=""" + $_.caption + """>" + $_.caption + "</a>" } } |
ConvertTo-html -Head $style -body "<H2>Windows Update Information (quickfixengineering)
</H2><H3>Creation Date: $date / Entries found: $fixcount</H3> "
#Decode lines with link and save
$html = $html | % { if($_ -match 'a href' ) { [System.Web.HttpUtility]::HtmlDecode($_) } else { $_ } }
$html | Out-File $scriptpath\html\$file
答案 1 :(得分:0)
试试这个:
$qfe = gwmi -class win32_quickfixengineering
$qfe | select-object -property HotFixID, Description, Caption,
@{LABEL="URL"; EXPRESSION={ "<a href=""" + $_.caption + """>" + $_.caption + "</a>" } } |
ConvertTo-html -Head $style -body "<H2>Windows Update Information (quickfixengineering)
</H2><H3>Creation Date: $date / Entries found: $fixcount</H3> " |
% { ($_.Replace("<","<")).Replace(">",">").replace(""",'"') }|
Out-File $scriptpath\html\$file