| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- @echo off
- setlocal EnableExtensions
- cd /d "%~dp0"
- chcp 65001 >nul
- set "XHS_PY=%~dp0python\py\python.exe"
- if not exist "%XHS_PY%" (
- echo [ERROR] Python not found: "%XHS_PY%"
- echo Check config.ini paths.pythonRelative
- call :BringCmdWindowToForeground
- pause
- exit /b 1
- )
- if "%~1"=="" goto interactive_loop
- "%XHS_PY%" "%~dp0workplace\main.py" %*
- goto end
- :interactive_loop
- set /p "KW=搜索关键词: "
- if "%KW%"=="" (
- echo 未输入搜索关键词。
- call :BringCmdWindowToForeground
- pause
- exit /b 1
- )
- set "SORT="
- set /p "N=请选择筛选条件:1 点赞最多 2 收藏最多 3 评论最多 直接回车=不筛选: "
- if "%N%"=="" set "SORT=0"
- if "%N%"=="0" set "SORT=0"
- if "%N%"=="1" set "SORT=likes"
- if "%N%"=="2" set "SORT=collect"
- if "%N%"=="3" set "SORT=comment"
- set "NOTE_ONE_BASED_INDEX="
- set /p "NOTE_ONE_BASED_INDEX=保存第几个笔记 (1=第一条 2=第二条 … 回车=第一条): "
- set "NOTE_ZERO_BASED_FOLDER_INDEX=0"
- if not "%NOTE_ONE_BASED_INDEX%"=="" (
- set /a NOTE_ZERO_BASED_FOLDER_INDEX=%NOTE_ONE_BASED_INDEX%-1
- )
- "%XHS_PY%" "%~dp0workplace\main.py" "%KW%" "%SORT%" %NOTE_ZERO_BASED_FOLDER_INDEX%
- set "EC=%ERRORLEVEL%"
- if not "%EC%"=="0" call :BringCmdWindowToForeground
- if not "%EC%"=="0" pause
- goto interactive_loop
- :end
- set "EC=%ERRORLEVEL%"
- if not "%EC%"=="0" call :BringCmdWindowToForeground
- pause >nul
- exit /b %EC%
- :BringCmdWindowToForeground
- powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0bring-cmd-window-foreground.ps1"
- goto :eof
|