@echo off chcp 65001 > nul cd /d "%~dp0" :: 中转站在国内,不走代理 set NO_PROXY=bww.letcareme.com,code.letcareme.com,letcareme.com,localhost,127.0.0.1 set no_proxy=%NO_PROXY% :: 优先 pwsh7: 新窗口启动 claude, 先从注册表缓存加载凭证 (DPAPI 解密) where pwsh >nul 2>nul if %errorlevel% equ 0 ( start "Bookworm Smart Assistant" pwsh -NoLogo -NoExit -Command "Add-Type -AssemblyName System.Security;$r='HKCU:\Software\Bookworm\CachedEnv';try{(Get-ItemProperty $r -EA Stop).PSObject.Properties|Where-Object{$_.Name-match'^[A-Z_]+$'}|ForEach-Object{$v=$_.Value;try{$b=[Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String($v),$null,[Security.Cryptography.DataProtectionScope]::CurrentUser);$v=[Text.Encoding]::UTF8.GetString($b)}catch{};[Environment]::SetEnvironmentVariable($_.Name,$v,'Process')}}catch{};& claude --dangerously-skip-permissions" exit ) :: 回退 PowerShell 5.1 title Bookworm Portable echo. echo [!] PowerShell 7 未安装, 使用 PowerShell 5.1 echo. powershell -ExecutionPolicy Bypass -File install.ps1 -StartOnly -AutoAccept if %errorlevel% neq 0 ( echo. echo 启动失败,按任意键退出... pause > nul )