LoginSignup
2
4

More than 3 years have passed since last update.

[バッチ] Tailっぽくログを監視できるバッチファイル

Last updated at Posted at 2019-08-28

やりたいこと

アプリなどが吐くログを、テキストエディタでいちいち開かずに、リアルタイムに監視したい。

やり方

PowerShellの-Tailを使う。

バッチのコード

MyTail.bat
@echo off
set TARGET="%1"
echo %TARGET% をモニタします。

powershell -NoProfile -ExecutionPolicy unrestricted -Command "Get-Content -Path %TARGET% -Tail 0 -Wait"

上記を書いたバッチファイルに見たいログファイルをドラッグしてやると、監視することができる。

2
4
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
2
4