- $log=gc a.log
- $name=$log -match "企业 名称"
- $quit=$log -match "退出当前"
- for($n=0;$n -lt $name.count;$n++){
- $begin=$name[$n].split("",6,[StringSplitOptions]::RemoveEmptyEntries)
- $end=$quit[$n].split("",[StringSplitOptions]::RemoveEmptyEntries)
- $time=(New-TimeSpan -start $begin[0] -end $end[0])
- "{0}{1}" -f '企业 >',$begin[-1]
- "{0}{1}{2}{3}{4}{5}{6}" -f '执行时间 >',$time.hours,'h:',$time.minutes,'m:',$time.seconds,'s'
- }
- $null=[console]::readkey()
复制代码 是这样吗 |