
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

使用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

翻译自: https://www.poftut.com/read-filter-windows-update-log-command-line/
windows读取文件命令