0

こんにちは、HTML でクイックフィックス エンジニアリングを出力するための簡単なスクリプトを書きましたが、何かがうまく機能していません。

$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の文字コードに変換されてしまいます。

そのようです:

&lt;a href=&quot;http://go.microsoft.com/fwlink/?LinkId=133041&quot;&gt;http:
//go.microsoft.com/fwlink/?LinkId=133041&lt;/a&gt;

私はいくつかのことを試しました。'' 文字も本当に役に立ちません (英語でこれらを呼び出す方法がわかりません)。

誰かアイデアがありますか/これを整理してください:) tnx

4

2 に答える 2

3

保存する前にデコードしてみてください:

$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
于 2013-02-13T13:57:53.737 に答える
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("&lt;","<")).Replace("&gt;",">").replace("&quot;",'"') }|
Out-File $scriptpath\html\$file
于 2013-02-13T14:03:51.557 に答える