根因: Start-Process pwsh 开新窗口但 claude 找不到 PATH, 同时 OneClick.bat 重复调用 install.ps1 导致双启动。 - install.ps1: 新增 -SkipLaunch 参数, step9 改为同步 & claude - auto-setup.ps1: Phase7 去掉 Start-Process, 同步 & claude - OneClick.bat: step7 加 -SkipLaunch, 最终块 start pwsh -Command claude - 启动/更新.bat: 直接 start pwsh -Command claude (不经 install.ps1) 架构: bat 决定窗口类型, ps1 只管同步执行 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
907 B
Batchfile
32 lines
907 B
Batchfile
@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%
|
|
|
|
:: 先更新配置 (在 cmd 中完成)
|
|
where pwsh >nul 2>nul
|
|
if %errorlevel% equ 0 (
|
|
pwsh -NoLogo -ExecutionPolicy Bypass -File "%~dp0install.ps1" -AutoAccept -SkipLaunch
|
|
) else (
|
|
powershell -ExecutionPolicy Bypass -File "%~dp0install.ps1" -AutoAccept -SkipLaunch
|
|
)
|
|
|
|
:: 更新后在 pwsh7 新窗口启动 claude
|
|
where pwsh >nul 2>nul
|
|
if %errorlevel% equ 0 (
|
|
start "Bookworm Smart Assistant" pwsh -NoLogo -NoExit -Command "& claude --dangerously-skip-permissions"
|
|
exit
|
|
)
|
|
|
|
:: 回退 PowerShell 5.1
|
|
title Bookworm Portable
|
|
powershell -ExecutionPolicy Bypass -File "%~dp0install.ps1" -StartOnly -AutoAccept
|
|
if %errorlevel% neq 0 (
|
|
echo.
|
|
echo 启动失败,按任意键退出...
|
|
pause > nul
|
|
)
|