[英]powershell out file to text file single line?
$Date2,$Difference | Out-File $To2\Outputfile.txt -Append -width 200
Resulting my output in text files in 2 lines as below in, however i am expecting in one line start with another line 结果我的输出在文本文件中如下两行所示,但是我期望一行以另一行开头
Friday, August 22, 2014 5:21:05 PM 00:00:07.4255524
Friday, August 22, 2014 5:22:15 PM 00:00:06.1931603
Any help is greatly appreciated 任何帮助是极大的赞赏
I think the problem is the ",". 我认为问题是“,”。 Use this
"$Date2,$Difference" | Out-File $To2\\Outputfile.txt -Append -width 200
使用此
"$Date2,$Difference" | Out-File $To2\\Outputfile.txt -Append -width 200
"$Date2,$Difference" | Out-File $To2\\Outputfile.txt -Append -width 200
In your example you are passing an array to the pipe with two elements $Date2,$Difference
which will make the statement on the right fire once for each element. 在您的示例中,您将一个带有两个元素
$Date2,$Difference
的数组传递给管道,这将使每个元素在正确的位置执行一次语句。 Creating a single string will add the output together in the file. 创建单个字符串会将输出添加到文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.