LoginSignup
1
2

More than 5 years have passed since last update.

batファイル > プロセスの起動時刻を表示する > powershell使用

Last updated at Posted at 2016-09-21
動作環境
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を入れることで、表示を止める。

qiita.png

USBメモリを挿せないシステムは検討していない。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2