Batch command run doesnt work in windows 10

41 views
Skip to first unread message

Varun Sareen

unread,
May 23, 2023, 10:31:13 AM5/23/23
to tesseract-ocr
I am using the below batch file to run a ocr job on muliple jpg's. But nothing happens after I run the job. Is something wrong with the script??

@Echo off
Set _SourcePath=C:\Users\sareev\Pictures\SN RC\*.jpg
Set _OutputPath=C:\Users\sareev\Pictures\SN RC\Output\
Set _Tesseract="C:\Program Files\Tesseract-OCR\tesseract.exe"
For %%A in (%_SourcePath%) Do Echo Converting %%A...&%_Tesseract% %%A %_OutputPath%%%~nA
Set "_SourcePath="
Set "_OutputPath="
Set "_Tesseract="

Zdenko Podobny

unread,
May 23, 2023, 12:16:24 PM5/23/23
to tesser...@googlegroups.com
Hello,

How do you run the script? What does it mean "nothing happens"? 
Is there any output on the screen? Any error, message?

Zdenko


ut 23. 5. 2023 o 16:31 Varun Sareen <varun...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/e87e4497-ec95-4dc1-a63c-dbbf4911409bn%40googlegroups.com.

Varun Sareen

unread,
May 23, 2023, 3:16:43 PM5/23/23
to tesser...@googlegroups.com
I have also explored the possibility of an alternate script as under:

@echo off
setlocal enabledelayedexpansion

set "SourcePath=C:\Users\sareev\Pictures\SN RC\px-conversions"
set "OutputPath=C:\Users\sareev\Pictures\SN RC\Output\Output"
set "TesseractPath=C:\Program Files\Tesseract-OCR\tesseract.exe"

for %%A in ("%SourcePath%\*.tiff") do (
    echo Converting %%A...
    "%TesseractPath%" "%%A" "%OutputPath%\%%~nA"
)

endlocal

And I get the below error in the console output. P.S. German is the default language of my CMD. 
C:\Users\sareev\Downloads>ocr_script.bat

C:\Users\sareev\Downloads>ÁÄÇ?€?ÃÃŽËÁÈ€Á1>ŽŽËÁÈ€‚ë?ÍÊÄÁ  & /ÈÇ…äš*íËÁÊË*Ë/ÊÁÁÎ* & ÑÄÈÍÊÁË*ë+€êä*øÌ Ä?1>Ë‚ŽËÁÈ€‚  | ÍÈøÍÈ & /ÈÇ…äš*íËÁÊË*Ë/ÊÁÁÎ* & ÑÄÈÍÊÁË*ë+€êä* | ÍÈøÍÈ* | ÍÈøÍÈ‚ŽËÁÈ€‚èÁËËÁÊ/ÄÈ & /ÈÇ…äš* & Ê?ÅÊ/_€ãÑÁË*èÁËËÁÊ/ÄÈ | äê*ÈÁËËÁÊ/ÄȆÁÌÁ‚ŽŽÃ?Ê€
Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.
Der Befehl "/ÈÇ…äš*íËÁÊË*Ë/ÊÁÁÎ*" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Der Befehl "ÑÄÈÍÊÁË*ë+€êä*øÌ Ä?" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

Based on the German text in the console output, it seems that there is an issue with the command syntax or the way the commands are written in the script.

The specific error message I received states: "Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch." This translates to "The syntax for the filename, directory name, or the volume label is incorrect." This error typically occurs when there is a problem with the format or structure of the file or directory path provided in the script.

However, I have rechecked everything and there are no issues with the filenames etc.

--
You received this message because you are subscribed to a topic in the Google Groups "tesseract-ocr" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tesseract-ocr/1QfPoXJhsbA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tesseract-oc...@googlegroups.com.

Zdenko Podobny

unread,
May 24, 2023, 1:40:03 AM5/24/23
to tesser...@googlegroups.com
I guess the problem is caused by space in the path. Try to rename folder "SN RC" e.g. to "SN_RC"


Zdenko


ut 23. 5. 2023 o 21:16 Varun Sareen <varun...@gmail.com> napísal(a):
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/CAO16hYJsLwbOmss_Q2X6jg-w%2BzFgj34SjwB3oPMEWKr2BG7Jcg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages