[SOLVED] Extract last run CheckSUR results

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
PAB
Posts: 57
Joined: 12 Aug 2019 13:57

[SOLVED] Extract last run CheckSUR results

#1 Post by PAB » 02 Oct 2019 13:27

Good evening everyone,

When SURT [System Update Rediness Tool] runs it creates a CheckSUR.log file in the C:\Windows\Logs\CBS folder.
Every time it is run it adds the new data to the bottom of the existing file.
Is there a way please to just extract the latest runs data?

Thanks in advance.
Last edited by PAB on 07 Nov 2019 09:31, edited 1 time in total.

aGerman
Expert
Posts: 3762
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Extract last run CheckSUR results

#2 Post by aGerman » 02 Oct 2019 14:09

Just use a FOR /F loop.

Code: Select all

@echo off &setlocal
for /f "usebackq delims=" %%i in ("C:\Windows\Logs\CBS\CheckSUR.log") do set "recent=%%i"
echo %recent%
pause
Depending on the size of the file it may take a while. I can't test the script since that log file doesn't exist on my machine.

Steffen

PAB
Posts: 57
Joined: 12 Aug 2019 13:57

Re: Extract last run CheckSUR results

#3 Post by PAB » 03 Oct 2019 12:05

Thank you by aGerman, it is appreciated.

Post Reply