2010-11-17 97 views

回答

5

添加前綴和後綴的文件的每一行(使用默認命令別名,這將是短了很多,但全名是更清晰):

get-content input-file | ` 
    foreach-object -process { "Prefix" + $_ + "Suffix" } | ` 
    out-file output-file 

添加-encoding UTF8out-file重寫默認編碼(UTF-16)。

要做到這一點output-file將需要一個臨時文件,然後在處理完成後替換input-file或將輸入文件讀入內存。

+0

工程就像一個魅力!謝謝:) – user510364 2010-11-17 22:48:26

+0

然後將此標記爲答案。 :) – JasonMArcher 2010-11-21 06:15:31

相關問題