function SaveTxtBody($ds)
{
$txtBody = ""
foreach ($item in $ds.Tables[0].Rows)
{
$line = ""
for ($index = 0; $index -lt $ds.Tables[0].Columns.Count; $index++) {
$line += $item[$index]
if (!($index -eq ($ds.Tables[0].Columns.Count -1)))
{
$line += ","
}
}
$txtBody += $line
$txtBody += [char]13+[char]10 # 換行符號
}
$txtBody > $pathSampleFile
}
2008/10/27
PowerShell : 換行符號
以下範例是將dataset一行一行的存入text file:
訂閱:
文章 (Atom)
-
一個糖果有一個糖果紙 一個糖果1元 現在商店在作促銷 3個糖果紙可以換1個糖果 請問 15元最多可以吃幾個糖果?
-
PS C:\> Get-Host Name : ConsoleHost Version : 2.0 InstanceId : 9c0bcffb-f780-402f-b4ab-696e29a34f67 UI : System.Management.Automation....
-
powershell c:\test\mypowershell_test.ps1 或是 powershell ./mypowershell_test.ps1 要把powershell放到排程裡,可用.bat檔把以上指令包起來即可。
