我已导入一个csv文件
$infile = import-csv .\myfile.csv
现在,我可以通过显示列(现在是对象属性)
$infile | gm -type NoteProperty
Name MemberType
------- ----------
Column1 NoteProperty
Column2 NoteProperty
etc...
我要做的是将
Name(Column1..)
的值转换为变量。
最佳答案
您可以使用select
$infile | gm -type NoteProperty | select -ExpandProperty Name
例如。,
$Names = @( $infile | gm -type NoteProperty | select -ExpandProperty Name )
关于powershell - 将Powershell对象属性的名称值转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27068904/