吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2977|回复: 11
收起左侧

[Debuggers] windbg_uwp版本的ps安装脚本

[复制链接]
fish猫 发表于 2025-8-7 14:35
本帖最后由 fish猫 于 2025-8-8 09:57 编辑

保存成ps1文件之后在powershell执行就可以避免在msStore中下载了
ps1代码

# 设置下载参数
$url = "https://windbg.download.prss.microsoft.com/dbazure/prod/1-2402-24001-0/windbg.msixbundle"
$outputFile = "$PSScriptRoot\windbg.msixbundle"

# 配置SSL协议(解决可能的证书问题)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# 创建WebClient对象
$webClient = New-Object System.Net.WebClient

# 初始化进度跟踪参数
$global:totalBytes = 0
$global:receivedBytes = 0
$global:lastUpdate = [DateTime]::Now
$global:lastBytes = 0

# 注册进度变更事件
Register-ObjectEvent -InputObject $webClient -EventName DownloadProgressChanged -Action {
    $global:totalBytes = $EventArgs.TotalBytesToReceive
    $global:receivedBytes = $EventArgs.BytesReceived
}

# 创建计时器更新进度条
$timer = New-Object Timers.Timer
$timer.Interval = 1000 # 1秒更新一次

# 定义计时器触发动作
$timerAction = {
    if ($global:totalBytes -gt 0) {
        # 计算下载速度
        $timeDiff = [DateTime]::Now - $global:lastUpdate
        $bytesDiff = $global:receivedBytes - $global:lastBytes
        $speed = ($bytesDiff / $timeDiff.TotalSeconds).ToString("0.00") + " KB/s"

        # 更新进度条
        $progress = ($global:receivedBytes / $global:totalBytes) * 100
        Write-Progress -Activity "正在下载 WinDbg..." `
            -Status ("已下载: {0} MB / {1} MB | 速度: {2}" -f `
                ($global:receivedBytes/1MB).ToString("0.00"), 
                ($global:totalBytes/1MB).ToString("0.00"),
                $speed) `
            -PercentComplete $progress

        # 更新速度计算基准
        $global:lastUpdate = [DateTime]::Now
        $global:lastBytes = $global:receivedBytes
    }
}

# 启动计时器
$timerElapsed = Register-ObjectEvent -InputObject $timer -EventName Elapsed -Action $timerAction
$timer.Start()

try {
    # 开始异步下载
    $webClient.DownloadFileAsync([Uri]$url, $outputFile)

    # 等待下载完成
    while ($webClient.IsBusy) {
        Start-Sleep -Milliseconds 500
    }

    # 停止计时器
    $timer.Stop()
    Unregister-Event -SourceIdentifier $timerElapsed.Name
    Write-Progress -Completed -Activity "下载完成"

    # 安装MSIX包
    if (Test-Path $outputFile) {
        Add-AppxPackage -Path $outputFile -ErrorAction Stop
        Write-Host "✅ WinDbg 安装成功" -ForegroundColor Green
    }
    else {
        Write-Host "❌ 文件下载失败,请检查网络连接" -ForegroundColor Red
    }
}
catch {
    Write-Host "❌ 发生错误: $_" -ForegroundColor Red
}
finally {
    $webClient.Dispose()
    Get-EventSubscriber | Unregister-Event
    Get-Job | Remove-Job -Force
}

有兄弟问,怎么下载最新版本的windbg
1.打开msdn的网址,https://learn.microsoft.com/zh-cn/windows-hardware/drivers/debugger/
52pj1.png
2.下载文件之后用记事本打开,复制里面的Url,替换上面ps1脚本的链接,就能下载最新的windbg了
52pj2.png

免费评分

参与人数 6吾爱币 +5 热心值 +6 收起 理由
gcode + 1 + 1 谢谢@Thanks!
jnct + 1 谢谢@Thanks!
salili + 1 + 1 我很赞同!
杨辣子 + 1 + 1 用心讨论,共获提升!
kseds + 1 + 1 我很赞同!
ytfh1131 + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Gumpsq 发表于 2025-8-7 15:38
大牛可以的
双赢天下 发表于 2025-8-7 18:53
free1031 发表于 2025-8-7 21:08
 楼主| fish猫 发表于 2025-8-8 09:57
双赢天下 发表于 2025-8-7 18:53
最新琏接在哪能时时看到

已经更新到上面
DonaldTiger 发表于 2025-8-8 15:08
大牛非常奈斯
双赢天下 发表于 2025-8-8 15:49
辛苦了!
kseds 发表于 2025-8-8 19:13
太牛了,感谢分享,学习
weiweiwei123 发表于 2025-8-9 11:22
学习下,太牛了。
salili 发表于 2025-8-10 23:03
惊为天人的操作
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-6-19 09:06

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表