-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLog.cmd
More file actions
28 lines (22 loc) · 637 Bytes
/
Log.cmd
File metadata and controls
28 lines (22 loc) · 637 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@echo OFF
echo Open latest log file
REM --- arguments ---
if "%~1"=="" goto help
REM --- rem change to log folder ---
SET LogPath=%PROGRAMDATA%\Ason\%1\logs\
echo log path: %LogPath%
pushd %LogPath%
REM --- find the latest log file ---
for /f "tokens=*" %%a in ('dir *.log* /b /od') do set LastestLog=%%a
if "%LastestLog%"=="" goto error
REM --- open powershell ---
echo opening log file %LastestLog%
start powershell -NoExit -Command "$host.ui.RawUI.WindowTitle = '%1 - %LastestLog%'; Get-Content %LastestLog% -Tail 10 -wait"
goto exit
:error
echo Missing log file in folder %LogPath%
pause
:exit
popd
SET LogPath=
SET LastestLog=