Get-Process s* |
where {s$_.Path} |
dir |
sort LastWriteTime |
Format-Table fullname, name,@{label="LastWriteTime";Expr={$_.LastWriteTime}
错误:
The hash literal was incomplete. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : IncompleteHashLiteral
能否请您提示我如何重写?
答案 0 :(得分:1)
您错过了花括号。但是您的代码中还有更多问题。 无法将System.Diagnostics.Process对象传递给'dir'
我做了这个,我认为它可以提供您想要的输出:
Get-Process s* |where {$_.Path} | ForEach-Object {Get-Item $_.Path } |
Sort-Object LastWriteTime | Format-Table fullname, name,LastWriteTime
它的作用: