首页 > 代码库 > $($_.)作用

$($_.)作用

1 $a=get-process2 foreach ($b in $a)3 {4  write-host "hello: $($b.id)"5 }

返回结果:

hello: 2536
hello: 3528
hello: 2316
hello: 608
hello: 732
hello: 1392
hello: 2456
hello: 2680
hello: 5940
hello: 3540

 

1 $a=get-process2 foreach ($b in $a)3 {4  write-host "hello: $b.id"5 }

返回结果:

hello: System.Diagnostics.Process (vmware-tray).id
hello: System.Diagnostics.Process (vmware-usbarbitrator64).id
hello: System.Diagnostics.Process (wininit).id
hello: System.Diagnostics.Process (winlogon).id
hello: System.Diagnostics.Process (wlanext).id
hello: System.Diagnostics.Process (WmiPrvSE).id
hello: System.Diagnostics.Process (WmiPrvSE).id
hello: System.Diagnostics.Process (WmiPrvSE).id
hello: System.Diagnostics.Process (wmpnetwk).id