windows读取文件命令_如何在命令行中读取和筛选Windows Update登录

windows读取文件命令

windows读取文件命令

Windows operating systems updates generally done automatically and prompting the installation and restart of the system. All these update operations creates logs about the operations and updated packages. In this tutorial we will look how to list, filter and search these update logs.

Windows操作系统更新通常自动完成,并提示安装和重新启动系统。 所有这些更新操作都会创建有关操作和更新程序包的日志。 在本教程中,我们将研究如何列出,过滤和搜索这些更新日志。

Windows更新日志文件 (Windows Update Log File)

First we need to locate the Windows update log file. Windows update log is by default located at systemroot . Systemroot is generally the location where the windows operating system files are installed which is C:\Windows in most cases.

首先,我们需要找到Windows更新日志文件。 Windows更新日志默认位于systemroot 。 通常, Systemroot是Windows操作系统文件的安装位置,大多数情况下为C:\Windows

打印所有更新日志 (Print All Update Log)

We can print all the windows update log without using any filter with ¢at command. We will also use some environment variables to accurately locate SystemRoot location with $env variable.

我们可以使用¢at命令不使用任何过滤器来打印所有的Windows更新日志。 我们还将使用一些环境变量来通过$env变量准确定位SystemRoot位置。

PS> cat $env:SystemRoot\WindowsUpdate.log

As we can see from listed event logs from ¢at command output there are following information about events.

¢at命令输出中列出的事件日志中可以看到,有关事件的以下信息。

  • Date

    Date

  • Time

    Time

  • Application Exit Status

    Application Exit Status

  • Subsystem

    Subsystem

  • Explanations

    Explanations

过滤日志 (Filter Logs)

As we list all log files in previous step it will create a lot of output. This is not a wanted situations especially if we are looking for a specific string. We can filter log with Powershell select-string command. In this example we will list only logs those contains FATAL string. This will list all FATAL type log which is a real interrupting problem.

当我们在上一步中列出所有日志文件时,它将创建很多输出。 这不是想要的情况,特别是如果我们正在寻找特定的字符串。 我们可以使用Powershell select-string命令过滤日志。 在此示例中,我们将仅列出包含FATAL字符串的日志。 这将列出所有FATAL故障日志,这是一个真正的中断问题。

PS> select-string -path $env:SystemRoot\WindowsUpdate.log FATAL
Filter Logs
Filter Logs
过滤日志

使用Get-WindowsUpdateLog(Using Get-WindowsUpdateLog)

Powershell for Windows Server 2012, Windows Server 2016, Windows 10 comes with a useful cmdlet which directly provides windows update logs without typing long and error prone commands. Get-WindowsUpdateLog powershell command can be used to list all logs like below.

适用于Windows Server 2012,Windows Server 2016,Windows 10的Powershell带有一个有用的cmdlet,可直接提供Windows更新日志,而无需键入冗长且容易出错的命令。 可以使用Get-WindowsUpdateLog powershell命令列出所有日志,如下所示。

PS> Get-WindowsUpdateLog

在文本编辑器中打开 (Open In Text Editor)

There is more GUI and user friendly was to list windows update event logs. This will open previously stated log file in Notepad. Just put following command into windows Run

还有更多的GUI,用户友好性是列出Windows更新事件日志。 这将在记事本中打开先前所述的日志文件。 只需将以下命令放入Windows Run

 windowsupdate.log
Open In Text Editor
Open In Text Editor
在文本编辑器中打开
LEARN MORE  Dism Command Tutorial To Repair Windows
了解更多Dism命令教程以修复Windows

翻译自: https://www.poftut.com/read-filter-windows-update-log-command-line/

windows读取文件命令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值