2010-11-17 101 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

相关问题