我正在尝试使用PowerShell读取数据并将其写入.txt文件。
但结果却被修剪了。
#Get the photo path of the students
$commandAD = $connection.CreateCommand()
#Retrieving student photo records.
$commandAD.CommandText = "SELECT [Barcode],[ImageURL] FROM
[iSAMS_Custom].[dbo].[vwDestinyLibrary_Student_photo1]"
$resultPhoto = $commandAD.ExecuteReader()
$tablePhoto = new-object "System.Data.DataTable"
$tablePhoto.Load($resultPhoto)
#Export Hash Table to Txt File
$tablePhoto | Out-File c:\Users\nimmy.pk\Documents\inputphoto.txt
如何格式化数据?
答案 0 :(得分:2)
您可以使用Out-File中的-Width参数:
$tablePhoto | Out-File -Width 4096 -Path c:\Users\nimmy.pk\Documents\inputphoto.txt