動作環境
Windows 7 pro
USBメモリを挿して、クリック一つで特定のプロセスの起動時刻を見たい。
参考 バッチファイルから PowerShell を呼び出す方法
参考 Get-Process bds | Select-Object StartTime
- 準備
- checkStartTime.ps1を作る
- checkStartTime.batを作る
- 運用
- ps1とbatが入ったUSBメモリを挿す
- checkStartTime.batをクリック
例として「bds.exe」を見るコード
grepを使うのは環境依存で、Select-Objectを使う方がいいことを@yumura_sさんに教えていただきました。
checkStartTime.ps1(間違い)
Get-Process bds | Format-List * | grep StartTime
checkStartTime.ps1(正しい)
Get-Process bds | Select-Object StartTime
checkStartTime.bat
powershell -NoProfile -ExecutionPolicy Unrestricted .\checkStartTime.ps1
pause
pauseを入れることで、表示を止める。
USBメモリを挿せないシステムは検討していない。