开发者

Creating/Formatting a .txt file from Powershell

I'm trying to export a table from sql and save it as an .txt using powershell. However, when I open my .txt file the data is not in table format

This is the format of my .txt file:

Name    :  Billy Bob
Address :  Nowhere Rd
State   :  NA
Number  :  999-999-9999

I would like for my .txt to be written in this format:

Name, Address, State, Number
Billy Bob, Nowhere Rd, NA, 999-999-9999

Or even this format will do, where the space between each column is the tab key

Name          Address        State     Number
Billy Bob     Nowhere开发者_JAVA百科 Rd     NA        999-999-9999 


without your code is not easy help you but if $a is a variable containinng the exported SQL table try this:

$a | export-csv "my.txt"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜