# dev-tools **Repository Path**: bb412387/dev-tools ## Basic Information - **Project Name**: dev-tools - **Description**: 常用的开发环境配置,一键配置 - **Primary Language**: PowerShell - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-04 - **Last Updated**: 2026-11-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: Powershell, Nodejs, Python ## README # dev-tools **一键配置 nvm 的 npm 源地址为淘宝源** ``` irm https://raw.giteeusercontent.com/bb412387/dev-tools/raw/master/set-npm-taobao.ps1 | iex ``` **一键配置 Python 的 pip 源地址为清华源** ``` irm https://raw.giteeusercontent.com/bb412387/dev-tools/raw/master/set-pip-tsinghua.ps1 | iex ``` **一键清理本机残留痕迹** ``` irm https://raw.giteeusercontent.com/bb412387/dev-tools/raw/master/Clean-RotkTraces.ps1 | iex ``` 默认**扫描全部用户**、只读不修改。确认报告没问题后再加 `-Apply` 实际清理(会先备份): ```powershell .\Clean-RotkTraces.ps1 # 扫描全部用户 .\Clean-RotkTraces.ps1 -Apply # 清理全部用户(需管理员) .\Clean-RotkTraces.ps1 -Apply -CurrentUser # 只清当前登录账户 .\Clean-RotkTraces.ps1 -Restore <备份目录> # 从备份还原注册表 ``` > 为什么默认全部用户:客户经常是用另一个账户(Administrator / 第二账户)跑的 > 游戏,只扫当前账户会报 "clean" 而实际什么都没清。 > `-AllUsers` 仍然保留,等价于默认行为。 删别的账户下的文件需要管理员权限。没提权时会明确提示,不会静默跳过。 ## Clean-RotkTraces.ps1 覆盖范围 脚本按"当前落点 + 旧落点"全列,只删**能确认是自己的**东西。 | 类别 | 位置 | 判定方式 | |---|---|---| | 注册表 | `HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState` | 只删 `FullPath` / `FindPath` 中 **REG_BINARY 且 256 字节** 的值;Explorer 自己的 `FullPath` 是 DWORD,不会被动 | | 注册表(旧) | `HKCU\Software\RotkOverlay` | 整棵都是我们建的,整个删除 | | 状态文件 | `%LOCALAPPDATA%\Microsoft\Windows\Caches\` 下 `edb0001..0006.log`、`edb0100.dat` | 文件名白名单;`edb0100.dat` 额外校验魔数 `CFG1` | | 状态文件(旧) | `%LOCALAPPDATA%\rotk\` 下 `lic.bin` 等 6 个 | 文件名白名单;目录空了就删 | | ADS | `rotkc*.dll` 上的 `:edb` `:edb2` `:edb3` `:edb4` `:rotklic` `:rotkonline` `:rotkmint` `:rotkdeny` | 按流名 | | 临时文件 | `%TEMP%\gfx_trace.log` / `gfx_perf.log` / `gfx_items.txt` / `gfx_trace.on` / `gfx_lic.log` | 文件名 | | 配置(旧) | `Documents\My Games\ROTK` / `My Games\H1Z1` / `Stan` 下的明文 ini | 按键名匹配;需 `-ScrubConfig` 才改文件,否则只报告 | > 当前版本配置已加密进 `edb0100.dat`,盘上不再有明文 ini。 > `Documents` 那一段只处理旧版本残留。 ## 设计约束 **脚本必须是纯 ASCII。** 生成的 `.ps1` 没有 BOM,PowerShell 5.1 会按 ANSI/GBK 解码。UTF-8 中文注释会被解成乱码字节,直接让解析器报错——一个全角引号就能让整个文件无法解析。 `tools/Patch-CleanScript.py` 在写入前会校验 ASCII-only,混进非 ASCII 字符会直接失败退出。 **只删能证明是自己的东西。** - 注册表按"类型 + 长度"匹配,不按名字(否则会删掉 Explorer 的合法设置) - 配置存储按魔数校验(否则会删掉系统里同名的缓存文件) - 系统目录(`Caches`)只删白名单文件,不删目录本身 ## 多账户场景 客户的 Windows 账户名不一定是 `Administrator`,profile 目录也不一定在 `C:\Users\<用户名>`。 脚本**不按目录名猜**,而是读注册表: ``` HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList └─ \ProfileImagePath -> 真实 profile 路径 ``` 服务账户(`S-1-5-18/19/20`)会被跳过。 **不带 `-AllUsers` 时**,如果检测到别的账户下还有痕迹,会明确提示: ``` === OTHER USERS traces found outside the current profile ================ [HIT ] otheruser C:\Users\Administrator\AppData\Local\rotk\lic.bin [HIT ] otheruser C:\Users\Administrator\AppData\Local\rotk\mint.dat These belong to another Windows account. Re-run with -AllUsers to clean them: .\Clean-RotkTraces.ps1 -AllUsers -Apply ``` 删别的账户的文件需要管理员权限。 ## 注意,请使用 PowerShell 运行