powershell out file to text file single line?

前端 未结 1 1180
南笙
南笙 2021-01-20 06:04
$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 expect

1条回答
  •  -上瘾入骨i
    2021-01-20 06:44

    I think the problem is the ",". Use this "$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. Creating a single string will add the output together in the file.

    0 讨论(0)
提交回复
热议问题