$curpatch="C:\Users\Administrator\Desktop\test"
$fileinfo=Get-ChildItem $curpatch -Recurse -force -Exclude *.inf|?{$_.mode -notmatch "d"}|select fullname
$userlist=$fileinfo|%{gc $_.fullname}#|?{$_ -match "身高|姓名" } #-or $_ -match "姓名"
$usertab=New-Object system.collections.arraylist
for($i=0;$i -lt $userlist.length;$i++){
$user=New-Object psObject|select 姓名,身高
$user.姓名=$userlist[$i++].split(":")[1]
$user.身高=$userlist[$i].split(":")[1]
$null=$usertab.add($user)
}
$usertab
阅读(1790) | 评论(0) | 转发(0) |