暂时无聊,发一个 保存为 xxx.pa1- $txt = '.\aa.txt';
- $contents= Import-Csv -Path $txt -Encoding Default|%{[pscustomobject]@{name=$_.姓名;time=$_.工作时间;work=$_.工作组}}
-
- $contents|group name,work|Where{$_.Group.Count -ge 2}|foreach{
- $t=$_.Group.time.Foreach{$_ -as [datetime]}
- $max = ($t|measure -Maximum).Maximum;
- $min = ($t|measure -Minimum).Minimum;
- $tL = $max-$min;
- $user = $_.Name.Split(',');
- [pscustomobject]@{姓名=$user[0];工作组=$user[1]; 工作时长="{0}d{1}h{2}m{3}s" -f $tL.Days,$tL.Hours,$tL.Minutes,$tL.Seconds;}
- }#|sc '.\result.log' -force;
- pause;
复制代码
|