1

到目前为止,我写了这个,它贯穿并完全按照我的意愿行事,现在我被卡住了。我似乎无法打开新创建的 $NOSPACE.shtml 并用变量 $SPACE 替换一个单词。请帮忙?

$CITYLIST=import-csv CityList.txt
$CITYLIST | FOREACH-OBJECT { $_ }
FOREACH ($Item in $CITYLIST) { 
$Item.City
$NOSPACE=$Item.City.replace(" ","_")
$SPACE=$Item.City
Add-Content _citylist.shtml "`n<a class=`"cityareaslist`" href=`"`/$NOSPACE.shtml`">    $SPACE<`/a>" ; Copy-Item index.shtml "$NOSPACE.shtml"
}
4

1 回答 1

0
(Get-Content "$NOSPACE.shtml") | 
Foreach-Object {$_ -replace 'word',$SPACE} | 
Set-Content "$NOSPACE.shtml"
于 2012-05-10T07:17:58.717 回答