agentleFS
28672032962867203296/hermes-agent/skills/devops/windows-master/SKILL.md

windows-master

Skill0 starsChanged 3 months agoMITView on GitHub

Windows 全栈维护:Office 修复、junction 数据迁移、Hermes 环境迁移、卸载残留清理、系统优化——一台机器所有 Windows 问题统一入口

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages

The file

Files
SKILL.md

Windows 全栈维护

你运行在 Windows 10 原生环境,Git Bash 终端。所有 Windows 问题统一从这里处理。

环境速查

  • Hermes 家目录:D:\Hermes
  • 软件目录:D:\sofeware\
  • 缓存目录:D:\sofeware\cache\
  • 用户文件夹:D:\All\(文档/下载/音乐/图片/视频已迁移)
  • Python:D:\sofeware\python\cpython-3.11-windows-x86_64-none\python.exe
  • venv Python:D:\Hermes\hermes-agent\.venv\Scripts\python.exe
  • 屏幕分辨率:1536x864
  • FFmpeg:D:\sofeware\ffmpeg\bin\

零、代理加速(Clash Verge / 魔戒)

用户使用魔戒机场 + Clash Verge ReV v2.5.1。代理端口:

  • HTTP 代理:127.0.0.1:7897(主用)

Clash Verge 安装包:D:/sofeware/cache/Clash.Verge_2.5.1_x64-setup.exe(v2.5.1,2026-07-04 通过 gh-proxy.com 下载)

验证代理可用:

curl -s --connect-timeout 5 -x http://127.0.0.1:7897 "https://github.com" -o /dev/null -w "%{http_code}"

使用代理下载:

curl -x http://127.0.0.1:7897 -L -o "输出文件" "URL"

Python 走代理:

import urllib.request
proxy = urllib.request.ProxyHandler({'https': 'http://127.0.0.1:7897'})
urllib.request.install_opener(urllib.request.build_opener(proxy))

无代理时用 GitHub 镜像:ghfast.top 或 gh-proxy.com(格式:https://镜像/https://github.com/...)

详见 references/clash-verge-proxy.md。

一、应用程序数据 junction 迁移(C→D)

把 AppData 用户数据搬到 D 盘,用 junction 透明链接。

通用步骤

# 1. 关闭应用
cmd //c "taskkill /f /im <进程名>.exe"

# 2. 创建目标
mkdir -p "/d/sofeware/cache/<AppName>/"

# 3. 搬数据
cp -r "$HOME/AppData/Roaming/<Vendor>/<Dir>" "/d/sofeware/cache/<AppName>/"
rm -rf "$HOME/AppData/Roaming/<Vendor>/<Dir>"

# 4. 建 junction(只能用 PowerShell!)
powershell -Command "New-Item -Path 'C:\Users\<user>\AppData\Roaming\<Vendor>\<Dir>' -ItemType Junction -Target 'D:\sofeware\cache\<AppName>\<Dir>'"

Pitfall:Git Bash 下 mklink 不可用

cmd //c 'mklink /J ...' 和 cmd.exe /c "mklink /J ..." 均不稳定,会启动交互式 cmd。

正确做法:用 PowerShell 的 New-Item -ItemType Junction。

验证

ls -la "<junction路径>/"    # 能看到目标内容 = 成功

用户文件夹迁移验证

通过"属性→位置"迁移后检查注册表:

reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"

应看到 Personal → D:\All\文档、My Music → D:\All\音乐 等。

PATH 不需要手动改,Windows 自动更新 Shell Folders 注册表。

二、卸载残留检查

应用卸载后按此清单扫描:

# 安装目录
ls "/d/sofeware/<AppName>"
ls "/c/Program Files/<AppName>"
ls "/c/Program Files (x86)/<AppName>"

# 用户数据
ls "$HOME/AppData/Roaming/<Vendor>/<AppName>"
ls "$HOME/AppData/Local/<Vendor>/<AppName>"

# 公共数据
ls "/c/ProgramData/<AppName>"

# 注册表
reg query "HKLM\SOFTWARE\<Vendor>\<AppName>"
reg query "HKCU\SOFTWARE\<Vendor>\<AppName>"

# 服务
sc query <ServiceName>

# 开始菜单
ls "/c/ProgramData/Microsoft/Windows/Start Menu/Programs/" | grep -i <keyword>

注意:HKLM\SOFTWARE\Microsoft\Office\Common 是 Windows 系统级残留,不影响使用,可忽略。

三、Office ClickToRun 修复

症状:所有 Office 应用报"操作系统当前的配置不能运行此应用程序"

根因:系统重置后 AppX 注册丢失,加上 Windows 10 家庭中文版无 AppVClient。

诊断流程

# 1. 文件完整性
ls "/c/Program Files/Microsoft Office/root/Office16/WINWORD.EXE"

# 2. 许可证状态(空白 = 许可证丢失)
cscript //Nologo "/c/Program Files/Microsoft Office/root/Office16/OSPP.VBS" /dstatus

# 3. ClickToRun 服务
sc query ClickToRunSvc

# 4. App-V 状态(1060 = 未安装)
sc query AppVClient

修复(按推荐度)

A. GUI 联机修复(最可靠) Win+I → 应用 → Microsoft 365 → 修改 → 联机修复

B. IntegratedOffice.exe

"/c/Program Files/Common Files/Microsoft Shared/ClickToRun/IntegratedOffice.exe" culture=zh-cn repair=Quick

C. MAS 重新激活

powershell -Command "irm https://get.activated.win | iex"
# 交互式,选 Office 激活选项

防止复发

MSYS_NO_PATHCONV=1 schtasks /Change /TN "Microsoft\Office\Office Startup Maintenance" /Disable

四、系统优化:进程审计 + 自启项管理

清点内存大户和自启项,砍掉不必要的后台进程。

4.1 内存占用排行

Get-Process | Sort-Object WorkingSet64 -Descending | 
  Select-Object -First 25 Name,Id,@{N="MemMB";E={[math]::Round($_.WorkingSet64/1MB,1)}} |
  Format-Table -AutoSize

hint:在 git-bash 里跑 PowerShell 时 $_ 会被 bash 转义,建议用 execute_code 工具调用 subprocess.run(['powershell.exe', ...])。

4.2 自启项三件套

注册表 Run 键:

reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

登录触发的计划任务:

Get-ScheduledTask | Where-Object { $_.Triggers | Where-Object { $_.Enabled -and ($_.CimClass.CimClassName -match 'BootTrigger|LogonTrigger|StartupTrigger') } } | Select-Object TaskName,TaskPath,State

自动启动的服务:

Get-Service | Where-Object { $_.StartType -eq 'Automatic' -and $_.Status -eq 'Running' } | Select-Object Name,DisplayName

4.3 常见可砍项

项目类型操作
PhoneExperienceHost (手机连接)系统组件 ~160MB设置→应用→可选功能→卸载
MicrosoftEdgeAutoLaunch注册表 Runreg delete HKCU\...\Run /v MicrosoftEdgeAutoLaunch... /f
QQLiveService (腾讯视频)服务 Automaticsc config QQLiveService start= demand
wpscloudsvr (WPS 云服务)服务 Manual通常已是手动,不用管
WPS 更新任务 (WpsUpdateTask/LogonTask/WakeWns)计划任务schtasks /Change /TN "任务名" /Disable
ASUS Update Checker计划任务schtasks /Change /TN "ASUS Update Checker 2.0" /Disable
Widgets (Win11 小组件)系统组件 ~65MB设置→个性化→任务栏→关闭小组件

Pitfall:schtasks 在 MSYS 下的编码问题

schtasks /query 输出含中文时 git-bash 识别为 binary,必须加 MSYS_NO_PATHCONV=1 前缀,或直接用 PowerShell 的 Get-ScheduledTask。

Pitfall:wmic 已废弃

Windows 10/11 新版移除了 wmic.exe,用 PowerShell Get-CimInstance 或 Get-ScheduledTask 替代。

详见 references/process-audit-and-startup.md。

五、磁盘清理

C 盘检查:D:\Hermes\scripts\clean_cache.py 每 10 天清 5GB 缓存。

大文件定位

用 Python 替代 du(Git Bash 的 du 在 Windows 上极慢):

import os
def get_dir_size(path):
    total = 0
    for dirpath, dirnames, filenames in os.walk(path):
        for f in filenames:
            fp = os.path.join(dirpath, f)
            try:
                total += os.path.getsize(fp)
            except OSError:
                pass
    return total

常见吃 C 盘大户

  • 微信(xwechat):%APPDATA%\Tencent\xwechat\ ~808MB
  • 企业微信(WXWork):%APPDATA%\Tencent\WXWork\
  • QQ:%APPDATA%\Tencent\QQ\
  • 腾讯系 AppData 合计约 2.2GB

六、Hermes 环境迁移

从 WSL 或另一台机器迁移 Hermes 到 Windows 原生。

备份提取

# WSL 备份在 tar.gz,MSYS 下必须 cp 到 /tmp 再解压
cp "E:/backups/hermes-home.tar.gz" /tmp/
cd /tmp/hermes_restore && tar xzf /tmp/hermes-home.tar.gz

恢复清单

  • config.yaml、AGENTS.md、.env(凭证)
  • profiles/*/memories/、profiles/*/config.yaml
  • MCP 服务器配置

WSL → Windows 路径转换

/home/zhengxin/... → D:\... 或 C:\Users\28672\...

七、Windows 常见 Pitfall 速查

#问题解决
1Ctrl+B 开始录音后立即停止Git Bash mintty 双触发,cli.py 加 1 秒防抖
2Ctrl+B 录了但没 Beep 声PortAudio 输出流失败,加 kernel32.Beep() 回退
3HF 模型下载失败HF_ENDPOINT=https://hf-mirror.com 到 .env
4HF 下载到 C 盘setx HF_HOME "D:\sofeware\cache\huggingface"
5TTS 生成 MP3 但没声音两种可能:(a) ffplay 不在 PATH,加 D:\\sofeware\\ffmpeg\\bin;(b) ffplay 被 Windows 应用控制策略阻止(Error 4551),需加 PowerShell/start 回退播放器。详见 references/voice-tts-windows-playback-fix.md
6TTS "No audio was received"语音不匹配文本语言,中文用 zh-CN-XiaoxiaoNeural
7PyPI/uv 安装卡住换腾讯云镜像 --index-url https://mirrors.cloud.tencent.com/pypi/simple/
8dup 命令卡死改用 Python os.walk,不用 du
9schtasks 路径被 MSYS 转换加 MSYS_NO_PATHCONV=1 前缀
10config.yaml 不能直接 patch用 hermes config set 或 terminal+Python 脚本
11终端命令弹窗口Hermes 源码无 CREATE_NO_WINDOW,需改源代码
12STT 误识别诅咒词faster-whisper 中文幻觉,不要反责用户
13TTS-STT 竞态反馈循环4 处 guard:静音/TTS/重启录音需互相等
14MsMpEng 占 400MB+把 dev 目录加入 Defender 排除列表
15VS Build Tools 装完不知道是否成功vswhere 定位 → Python subprocess + shell=True 跑 vcvars64 && cl
16computer_use 点桌面图标没反应Windows 桌面/任务栏图标需要 double_click 而非 click。UWP 应用(汽水音乐等)即使双击也无法后台启动,需用户手动打开后再操作(详见 references/computer-use-uwp-limitation.md)
17computer_use 截图报 400 "unknown variant image_url"auxiliary.vision 模型不支持图像。需在 config.yaml 将 auxiliary.vision.model 改为视觉模型(千问 qwen3-vl-plus 等),详见 references/computer-use-vision-fix.md
18npm install -g 大包下载超时代理可能挂了,先 curl -x http://127.0.0.1:7897 https://registry.npmjs.org 验证。不用代理时切回 npmmirror:--registry https://registry.npmmirror.com
19bl auth login 报 "fetch failed"百炼是阿里云国内服务,不能走代理。执行前 unset https_proxy http_proxy
20PowerShell 敲 openclaw 报"无法识别"或找到旧版删 bash 脚本留 .cmd,加 D:\\\\openclaw 到 PATH 最前,npm uninstall -g 后手动清 %APPDATA%\\\\npm\\\\ 残留
21开机后突然上不了网,浏览器全部打不开Clash Verge 没启动但系统代理开关还开着(127.0.0.1:7897),所有流量撞死代理。先查 reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable,如果是 0x1 就 reg add ... /v ProxyEnable /t REG_DWORD /d 0 /f 关掉。或者启动 Clash Verge 也行
22Git Bash 下 curl 下载到 /d/sofeware/ 报 No such filegit-bash 的 MSYS 路径 /d/... 在 curl 的 -o 参数中不稳定,即使 mkdir -p 也偶发失败。用 Windows 原生路径:curl -o "D:\\sofeware\\..." 替代 curl -o /d/sofeware/...
23ghfast.top 下载大文件超时镜像限速 ~25KB/s,12MB 需 8-10 分钟。用 curl --max-time 600,中断后 -C - 续传。代理直连更快但 SSL 可能失败需加 -k,详见 pitfall #24
24Hermes 浏览器工具报 Chrome not foundHermes 默认浏览器后端是 agent-browser(非系统 Chrome)。完整安装:下载 exe → -C - 续传 → agent-browser install(需代理下载 Chrome 150MB)。代理 SSL 问题加 curl -k。详见 references/agent-browser-setup.md
26ffplay 被 Windows 应用控制策略阻止 (Error 4551)play_audio_file 在 Windows 上唯一播放器就是 ffplay,被 WDAC/AppLocker 阻止后 TTS 无声。临时绕过:cmd /c start \"\" \"音频文件.mp3\" 调系统播放器。永久修复:给 play_audio_file 加 Windows 回退(PowerShell MediaPlayer 或 start)。详见 references/voice-tts-windows-playback-fix.md
27开发工具(GitHub/Adoptium)直连下载失败国内网络下 GitHub Releases 和 Adoptium API 常 404/403/超时。winget 不走代理,下载仍可能超时。正确模式:①写 Python 下载脚本到文件(支持断点续传+重试)②terminal 后台 + notify_on_complete ③用完整 Python 绝对路径(非 python 命令)④参数用 D:/ 格式(非 /d/)⑤urllib+ProxyHandler 走代理。curl git-bash 下写 MSYS 路径必失败,execute_code 有 5 分钟超时。优先 ZIP 而非 MSI:MSI 自定义安装路径(INSTALLDIR)在静默模式下不可靠,ZIP 直接解压 0 风险。下载脚本:scripts/download.py。详见 references/dev-tools-install.md
28下载完 MSI 后改用 ZIP,旧 MSI 残留切换下载方案后主动告知用户并立即删除无用文件 rm -f /d/sofeware/cache/*.msi。用户对残留文件零容忍,不要说"我会删",直接删了汇报。
29没装 WSL 但老弹窗"适用于 Linux 的 Windows 子系统必须更新"分两步根治:①禁用 WSL 功能 powershell -Command "Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux" ②禁用虚拟机平台 Disable-WindowsOptionalFeature -FeatureName VirtualMachinePlatform ③如果弹窗还在,用 computer_use list_apps 找到 wsl.exe 的 PID,taskkill /f /pid <PID> 杀掉残留进程 ④终极手段:mv /c/Windows/System32/wsl.exe /c/Windows/System32/wsl.exe.bak 让任何程序都调不动。禁用后需要重启才能完全生效,但改名立竿见影。
30setx vs PowerShell 设环境变量setx JAVA_HOME "D:\sofeware\java" 在 git-bash 下可靠;PowerShell [Environment]::SetEnvironmentVariable 偶发超时。日常优先用 setx。
31MSI 静默安装自定义路径失败(如 JDK MSI → D:\sofeware\java)msiexec /i xxx.msi INSTALLDIR="D:\..." /quiet 参数名因 MSI 而异,静默模式下无法验证。优先下载 ZIP 版直接解压,0 依赖 0 风险。已确认可用:JDK ZIP https://github.com/adoptium/temurin21-binaries/releases/...zip,MinGW ZIP https://github.com/brechtsanders/winlibs_mingw/releases/...zip。
32winget 安装 MinGW/JDK 的包名MinGW(MSVCRT+POSIX):BrechtSanders.WinLibs.POSIX.MSVCRT。JDK 21:EclipseAdoptium.Temurin.21.JDK。但 winget 不走代理,国内慢,优先用 Python 下载脚本走代理。

八、相关参考文件

  • references/office-repair.md — Office 详细修复记录(含 2026-06-30 系统重置案例)
  • references/wps-data-migration.md — WPS 数据迁移详细步骤
  • references/continuous-voice-mode.md — 连续语音模式配置
  • references/huggingface-cache-windows.md — HF 缓存 + 国内网络
  • references/voice-ffplay-path.md — ffplay PATH 修复
  • references/voice-tts-stt-race-fix.md — TTS/STT 竞态修复
  • references/china-pypi-mirrors.md — 国内 PyPI 镜像
  • references/c-drive-cleanup.md — C 盘清理清单
  • references/vs-build-tools-verify.md — VS Build Tools 安装验证
  • references/dev-tools-install.md — Windows 开发工具安装(MinGW/JDK 下载+解压+环境变量,ZIP优先,MSI避坑)
  • references/edge-browser-automation.md — Edge 浏览器自动化(Playwright + mcp-chrome)
  • references/agent-browser-setup.md — agent-browser Windows 安装全流程(下载/续传/代理/Chrome 运行时)
  • references/zip-manual-extraction.md — 损坏 ZIP 手动提取技术
  • references/process-audit-and-startup.md — 进程审计 + 自启项管理命令速查
  • references/clash-verge-proxy.md — Clash Verge 代理配置 + GitHub 镜像下载
  • references/computer-use-uwp-limitation.md — cua-driver 无法后台启动 UWP 应用
  • references/computer-use-vision-fix.md — SOS 截图报 400 错误:视觉模型配置修复
  • references/bailian-cli-setup.md — 阿里云百炼 CLI 安装、配置、API 对接全流程
  • references/free-api-status.md — 国产大模型免费 API 逆向状态追踪(即梦/DeepSeek/Kimi/豆包等)
  • references/openclaw-setup.md — OpenClaw + 百炼 Coding Plan 部署配置

九、浏览器自动化与桌面操控

详见 references/edge-browser-automation.md。

快速入口

方案脚本用途
agent-browserD:\\sofeware\\agent-browser\\agent-browser.exeHermes 原生浏览器后端(自动装 Chrome)
Playwright + EdgeD:\\\\Hermes\\\\scripts\\\\browser_agent.py搜索、抓取、截图
mcp-chrome-bridgenpm 包 + Edge 扩展操作用户已登录网页
computer_usecua-driver桌面 GUI 操控

Pitfall:computer_use 无法启动 UWP 应用

详见 references/computer-use-uwp-limitation.md。

cua-driver 后台模式下点击任务栏 UWP 应用图标(汽水音乐、腾讯视频等)不会启动。Win+搜索、PowerShell Start-Process 均无效。让用户手动打开 UWP 应用,打开后 cua-driver 可正常操作其窗口。

Pitfall:browser-use 包名陷阱

PyPI 上 browser-use(连字符)是 CLI 工具而非 AI Agent 库,安装会降级 openai/pydantic/rich,破坏 Hermes。不要装。直接用 Playwright。

十、损坏 ZIP 修复

详见 references/zip-manual-extraction.md。

当 zipfile.ZipFile() 和 shutil.unpack_archive() 都报 "not a zip file" 但文件头正确(PK\x03\x04)时,手动遍历 local file headers 逐个提取文件数据。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.