windows sysinternals 提供了许多微软的实用工具,比如
process explorer
process monitor
tcpview
autoruns
dbgview
运行后的效果如下:

PowerShell 代码如下:
function Update-SysinternalsHTTP ($ToolsLocalDir = "c:\temp\sys") {
if (Test-Path $ToolsLocalDir){
cd $ToolsLocalDir
$DebugPreference = "SilentlyContinue"
$wc = new-object System.Net.WebClient
$userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;)"
$wc.Headers.Add("user-agent", $userAgent)
$ToolsUrl = "https://www.php.cn/link/72e88ee102cc8afc75cbbb182cca9306"
$toolsBlock=".*"
$WebPageCulture = New-Object System.Globalization.CultureInfo("en-us")
$Tools = @{}
$ToolsPage = $wc.DownloadString($ToolsUrl)
$matches=[string] $ToolsPage select-string -pattern "$ToolsBlock" -AllMatches
foreach($match in $matches.Matches) {
$txt = ( ($match.Value -replace "<br></br>", "`r`n") -replace "]*?>","")
foreach($lines in $txt.Split("`r`n")){
$line=$linesselect-string -NotMatch -Pattern "To Parent^$<dir>"
if ($line -ne $null){
$date=(([string]$line).substring(0,38)).trimstart(" ") -replace " "," "
$file=([string]$line).substring(52,(([string]$line).length-52))
$Tools["$file"]= [datetime]::ParseExact($date,"f",$WebPageCulture)
}
}
}
$Tools.keys
ForEach-Object {
$NeedUpdate=$false
if (Test-Path $_)
{
$SubtractSeconds = New-Object System.TimeSpan 0, 0, 0, ((dir $_).lastWriteTime).second, 0
$LocalFileDate= ( (dir $_).lastWriteTime ).Subtract( $SubtractSeconds )
$needupdate=(($tools[$_]).touniversaltime() -lt $LocalFileDate.touniversaltime())
} else {$NeedUpdate=$true}
if ( $NeedUpdate )
{
Try {
$wc.DownloadFile("$ToolsUrl/$_","$ToolsLocalDir\$_" )
$f=dir "$ToolsLocalDir\$_"
$f.lastWriteTime=($tools[$_])
"Updated $_"
}
catch { Write-debug "发生错误: $_" }
}
}
}
}
cls
"更新开始..."
Update-Sysinternalshttp -ToolsLocalDir "D:\Tools"
"更新结束"将上述脚本保存为
.ps1
D:\Tools
以上就是Windows Sysinternals 工具自动更新脚本的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号