【发布时间】:2017-08-11 01:53:53
【问题描述】:
我目前正在将目录中的文件中的名称、全名、基本名称提取到文本文件中。我还想从我正在查看的文件的属性中提取“评论”字段到同一个文本文件。
这可以使用 Get-ChildItem 还是我需要使用不同的东西?
Get-ChildItem "\\otahnas02\TCG\Embroidery" | Select Name, FullName, BaseName,
@{ n = 'Folder'; e = { Convert-Path $_.PSParentPath } }, `
@{ n = 'Foldername'; e = { ($_.PSPath -split '[\\]')[-2] } } | Sort-Object name |
Export-Csv "\\nzsdf01\c$\SCRIPTS\EmbroideryUpdateDirectory.txt" -Encoding Utf8 -NoTypeInformation
我尝试在脚本的选择中添加注释,但这不起作用。我猜 Comments 属性不是 Get-ChildItem 的一部分?不是 powershell 专家。
【问题讨论】:
-
嗨卡洛斯,如果你这样做:Get-ChildItem "\\otahnas02\TCG\Embroidery" | Get-Member,是否有符合您需要的 Property Member Type?
标签: powershell