Home > database >  Convert odt to pdf in batch file with spaces in the name
Convert odt to pdf in batch file with spaces in the name

Time:10-20

I'm trying to write a script to convert all odt files except the 2 models to pdf. This .bat works perfectly for odt files that do not contain spaces in their name, but not otherwise.

This is my script so far :

@ECHO OFF

for %%f in (*.odt) do (
    echo %%f | findstr /i /L "Model_A.odt" > nul
    if errorlevel 1 (
        echo %%f | findstr /i /L "Model_B.odt" > nul
        if errorlevel 1 (
            echo %%f
            "C:\Program Files\LibreOffice\program\soffice.bin" --convert-to "pdf" --outdir            
  • Related