Chr*_*ite 1 powershell powershell-2.0
我导入了一个csv文件
$infile = import-csv .\myfile.csv
Run Code Online (Sandbox Code Playgroud)
现在我可以通过显示列(现在是对象属性)
$infile | gm -type NoteProperty
Name MemberType
------- ----------
Column1 NoteProperty
Column2 NoteProperty
etc...
Run Code Online (Sandbox Code Playgroud)
我想要做的是获取Name(Column1..)变量的值.
您可以使用 select
$infile | gm -type NoteProperty | select -ExpandProperty Name
Run Code Online (Sandbox Code Playgroud)
例如,
$Names = @( $infile | gm -type NoteProperty | select -ExpandProperty Name )
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5481 次 |
| 最近记录: |