基于我在这里发布的另一个问题,我能够获得这个脚本的大部分工作,但我不知道如何更改选择对象的格式。谷歌一直没有帮助。输出变量时的条形标题
$head = @'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Current Conditions</title>
</head>
<body style="background-color:#EEEEEE">
<h3 style="margin:0;padding-bottom:3px">Current Conditions at
'@
$1 = @'
</h3>
<p style="margin:0;padding-bottom:0px"><b>Dewpoint: </b>
'@
$2 = @'
</p>
<p style="margin:0;padding-bottom:0px"><b>Temperature: </b>
'@
$3 = @'
</p>
<p style="margin:0;padding-bottom:3px"><b>Humidity: </b>
'@
$end = @'
</p>
</body>
</html>
'@
$info = import-csv 1-pastweek.csv
$time = $info | select -last 1 Time
$temp = $info | select -last 1 Temp
$humid = $info | select -last 1 Humid
$dewpt = $info | select -last 1 Dewpt
$head + $time + $1 + $dewpt + $2 + $temp + $3 + $humid + $end | out-file -encoding "UTF8" current.html
这并不工作,但HTML输出的格式包括从CSV的头信息,我不明白怎么去解决它。
Current Conditions at @{TIME=03/12/2012 15:32:22}
Dewpoint: @{DEWPT=62.7}
Temperature: @{TEMP=71.9}
Humidity: @{HUMID=74.4}
有关如何让@ {HEADER}消失的任何想法。我只想要实际的数据。
谢谢你。我确实找到了扩展属性,但没有正确使用它。另外,我喜欢你的最后一点。这将是我做到这一点的方式。这很容易。谢谢。 – 2012-03-12 21:57:05