scoop bucket qq脚本分析(qq绿色安装包制作)

url字段

以qq.json为例,其对应的scoop配置文件在$env:scoop\buckets\extras\bucket\qq.json

其中的url字段

bash 复制代码
"url":"https://webcdn.m.qq.com/spcmgr/download/QQ9.7.17.29230.exe#/dl.7z"

为qq安装包下载地址,后缀#/dl.7z为自行添加,表明该安装包的解压方式使用7z,解压命令7z.exe x qq.exe -o,解压默认目录为$env:scoop/apps/qq/9.7.17.29230/

QQ9.7.17.29230.exe安装包内容解构及其绿色化

解压之后调用"installer"字段,其中的执行步骤如下:

  1. 删除.rsrc目录之外的所有文件
  2. 使用7z解压其中的$dir\.rsrc\2052\MSI\101\Files到当前目录。Files中包含bin\qq.exe等重要可执行文件。
  3. 使用7z解压其中的$dir\.rsrc\2052\MSI\102到临时目录,其中有重要的系统级别动态库dll
  4. 拷贝上一步中的动态库dll到bin目录中,以便qq.exe寻找到库。
  5. 使用7z解压其中的TXSSOSetup.exe,该程序用于网页的qq快速登陆
  6. 清理当前目录

附qq.json内容如下

json 复制代码
{
    "version": "9.7.17.29230",
    "description": "An instant messaging tool that gives you the best way to keep in touch with your friends and family.",
    "homepage": "https://im.qq.com",
    "license": {
        "identifier": "Proprietary",
        "url": "https://ti.qq.com/agreement/index.html"
    },
    "notes": [
        "Scoop doesn't persist your QQ data, by default they are stored in: ",
        "'%UserProfile%\\Documents\\Tencent Files'.",
        "Files produced at runtime leaves in '%AppData%\\Tencent'."
    ],
    "url": "https://webcdn.m.qq.com/spcmgr/download/QQ9.7.17.29230.exe#/dl.7z",
    "hash": "5ae1949f7ba4c65bf82ee53c55053ad91cb524150a93bf1d2035e530c54757c9",
    "shortcuts": [
        [
            "Bin\\QQScLauncher.exe",
            "QQ"
        ]
    ],
    "installer": {
        "script": [
            "Get-Item \"$dir\\*\" -Exclude .rsrc | Remove-Item",
            "Expand-7zipArchive \"$dir\\.rsrc\\2052\\MSI\\101\" \"$dir\" -ExtractDir 'Files'",
            "Expand-7zipArchive \"$dir\\.rsrc\\2052\\MSI\\102\" \"$dir\\temp\"",
            "'vcruntime140.dll', 'msvcp140.dll', 'msvcr100.dll', 'vcomp140.dll', 'msvcp100.dll' | ForEach-Object {",
            "  Move-Item \"$dir\\temp\\$_\" \"$dir\\Bin\\\"",
            "}",
            "Expand-7zipArchive \"$dir\\temp\\TXSSO\\TXSSOSetup.exe\" \"$dir\\Bin\\TXSSO\" -ExtractDir 'TXSSO'",
            "Remove-Item \"$dir\\.rsrc\", \"$dir\\temp\" -Recurse"
        ]
    },
    "checkver": {
        "url": "https://pc.qq.com/detail/2/detail_2.html",
        "regex": "QQ([\\d.]+).exe"
    },
    "autoupdate": {
        "url": "https://webcdn.m.qq.com/spcmgr/download/QQ$version.exe#/dl.7z"
    }
}
相关推荐
Vex2une1 天前
PowerShell 发展史:从命令行外壳到跨平台自动化引擎
windows·自动化·azure·powershell·vs code·脚本语言·dsc
Vex2une3 天前
PowerShell ISE 到 VS Code 迁移史:从集成脚本环境到现代编辑器工作流
windows·vscode·powershell·powershell ise·powershell 扩展·powershell 7·脚本编辑器
Vex2une6 天前
Windows PowerShell 发展史:从命令行工具到自动化核心
windows·自动化运维·命令行·powershell·cmd·脚本语言·对象管道
iCxhust8 天前
Powershell脚本,列出近3日打开的文件夹并打开
程序人生·powershell
谷哥的小弟10 天前
基于PowerShell的Chrome无痕访问
chrome·powershell·网络环境·无痕访问
Blockbuater_drug22 天前
setx 设完读不到?Windows 系统环境变量作用域、截断坑与 AI 工具密钥管理
注册表·powershell·api key·mcp server·windows 环境变量·setx·环境变量插值
bosins1 个月前
Windows IIS 配置本地HTTPS 全流程指南:自签名证书 + 端口绑定 + 避坑详解
powershell·openssl
DogDaoDao1 个月前
Windows 开发提效工具全景指南:60+ 工具的工程化分层配置
windows·git·程序员·开发工具·powershell·everything·msys2
winfredzhang2 个月前
用 wxPython 打造「Claude Code 任务启动器」:一个把 AI CLI 变成一键工作流的桌面工具
python·wxpython·powershell·剪贴板·claudecodecli
鬼手点金2 个月前
Hermes‑Agent 使用教程
python·ubuntu·powershell·cmd·ai agent·opencode·hermes