OCR/run.bat
2025-05-13 11:07:14 +08:00

39 lines
1.1 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
REM 设置CMD窗口的代码页为UTF-8
chcp 65001
title OCR监控工具
REM 检查Java是否安装
java -version >nul 2>&1
if errorlevel 1 (
echo 错误: 未检测到Java请安装Java 11或更高版本
pause
exit /b 1
)
REM 检查Tesseract是否安装
if not exist "C:\Program Files\Tesseract-OCR\tesseract.exe" (
echo 错误: 未检测到Tesseract-OCR请安装Tesseract-OCR
pause
exit /b 1
)
REM 检查jar文件
if not exist "target\image-ocr-monitor-1.0-SNAPSHOT-jar-with-dependencies.jar" (
echo 错误: 未找到jar文件请先运行re-build-start.bat进行编译
pause
exit /b 1
)
REM 设置Tesseract环境变量
set "TESSDATA_PREFIX=%~dp0tessdata"
echo 设置TESSDATA_PREFIX=%TESSDATA_PREFIX%
REM 确保目录存在
if not exist "ocr_results" mkdir ocr_results
if not exist "test_images" mkdir test_images
if not exist "ocr_images" mkdir ocr_images
echo 正在启动OCR监控工具...
java -Dfile.encoding=UTF-8 -Dfile.client.encoding=UTF-8 -Dtessdata.path="%~dp0tessdata" -Duser.language=zh -Duser.country=CN -jar target\image-ocr-monitor-1.0-SNAPSHOT-jar-with-dependencies.jar
pause