2015-02-11 103 views
0

我的同事在线发现了这个Batch命令(Windows中的Powershell Command),我需要知道它用于输出到文件的“编码”。我知道它不是utf-8。下面是一个命令:PowerShell命令 - 这个输出是什么?

Select-String logfile.log -pattern "string pattern" | tee-object -filepath "output_file.txt" -append 

我的Windows版本为Windows Server 2012 RC标准

回答

1

https://technet.microsoft.com/en-us/library/hh849937.aspx

Tee-Object两者使用Unicode编码时,将其写入文件。因此,输出可能无法在具有不同编码的文件中正确格式化。要指定编码,请使用Out-File cmdlet。

在PowerShell中找到命令Select-String

+0

对,谢天谢地。我使用了out-file -encoding UTF8。 – 2015-02-11 22:24:53