Powershell 转换为html输出字符代码而不是字符

Powershell 转换为html输出字符代码而不是字符,powershell,powershell-3.0,Powershell,Powershell 3.0,嗨,我写了一个简单的脚本,用于输出html格式的quickfixengineering,但有些东西并没有真正令人满意 $qfe = gwmi -class win32_quickfixengineering $qfe | select-object -property HotFixID, Description, Caption, @{LABEL="URL"; EXPRESSION={ "<a href=""" + $_.caption + """>" + $_.caption +

嗨,我写了一个简单的脚本,用于输出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
我试过几种方法。“”字符对我也没什么帮助(不知道如何用英语称呼它们。)如果事情不够字面化,这些字符会使它更加字面化


是否有人有想法/可以帮我整理一下:)tnx

在保存之前尝试解码:

$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
$qfe=gwmi-类win32\u quickfixengineering
$html=$qfe |选择对象-属性HotFixID、说明、标题、,
@{LABEL=“URL”表达式={”“}|
转换为html-Head$style-body“Windows更新信息(quickfixengineering)
创建日期:$Date/找到的条目:$fixcount“
#使用链接解码行并保存
$html=$html |%{if($\-match'a href'){[System.Web.HttpUtility]::HtmlDecode($\)}else{$\}
$html |输出文件$scriptpath\html\$File

保存前尝试解码:

$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
$qfe=gwmi-类win32\u quickfixengineering
$html=$qfe |选择对象-属性HotFixID、说明、标题、,
@{LABEL=“URL”表达式={”“}|
转换为html-Head$style-body“Windows更新信息(quickfixengineering)
创建日期:$Date/找到的条目:$fixcount“
#使用链接解码行并保存
$html=$html |%{if($\-match'a href'){[System.Web.HttpUtility]::HtmlDecode($\)}else{$\}
$html |输出文件$scriptpath\html\$File
试试这个:

$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
$qfe=gwmi-类win32\u quickfixengineering
$qfe |选择对象-属性热修复ID、说明、标题、,
@{LABEL=“URL”表达式={”“}|
转换为html-Head$style-body“Windows更新信息(quickfixengineering)
创建日期:$Date/找到的条目:$fixcount“|
%{($\.Replace(“,”).Replace(“,”)}|
输出文件$scriptpath\html\$File
试试这个:

$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
$qfe=gwmi-类win32\u quickfixengineering
$qfe |选择对象-属性热修复ID、说明、标题、,
@{LABEL=“URL”表达式={”“}|
转换为html-Head$style-body“Windows更新信息(quickfixengineering)
创建日期:$Date/找到的条目:$fixcount“|
%{($\.Replace(“,”).Replace(“,”)}|
输出文件$scriptpath\html\$File

aah k不知道有一个函数可以将其整齐地编码为html。nice answer tnx alotaah k不知道有一个函数可以将其整齐地编码为html。nice answer tnx alot