ConvertTo-CsvTYPEの削除 -NoTypeInformationオプションPS> dir *.txt | select FullName, FileSize, LastWriteTime | ConvertTo-Csv #TYPE Selected.System.IO.FileInfo <= *** この行が不要な場合 *** "FullName","FileSize","LastWriteTime" "C:\tmp\1.txt"," 786 B ","2018/05/15 3:40:31" "C:\tmp\2.txt"," 786 B ","2018/05/15 3:40:24" ↓ PS> dir *.txt | select FullName, FileSize, LastWriteTime | ConvertTo-Csv -NoTypeInformation "FullName","FileSize","LastWriteTime" "C:\tmp\1.txt"," 786 B ","2018/05/15 3:40:31" "C:\tmp\2.txt"," 786 B ","2018/05/15 3:40:24" デリミタの指定 -Delimiterdir * | select FullName, FileSize, LastWriteTime | ConvertTo-Csv -Delimiter "`t" ここではタブ区切りを指定。 最初の行のヘッダーなど、邪魔な行があるのを消す select -SkipPS> dir *.txt | select FullName, FileSize, LastWriteTime | ConvertTo-Csv -NoTypeInformation "FullName","FileSize","LastWriteTime" <= *** この行が邪魔 *** "C:\tmp\1.txt"," 786 B ","2018/05/15 3:40:31" "C:\tmp\2.txt"," 786 B ","2018/05/15 3:40:24" ↓ PS> dir *.txt | select FullName, FileSize, LastWriteTime | ConvertTo-Csv -NoTypeInformation | select -Skip 1 "C:\tmp\1.txt"," 786 B ","2018/05/15 3:40:31" "C:\tmp\2.txt"," 786 B ","2018/05/15 3:40:24" 参考https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/convertto-csv |
|