I'm trying to convert a bunch of wpd filed into docx with libreoffice, so far I have been able to achieve it but the resultant docx files are saved in just one folder (Ale) instead of Ale and its subdirectories, and what I want is for the docx files to be saved in the folder the wpd file are in. So far I have:
set path=%path%;"C:\Program Files (x86)\LibreOffice 5\program"
for /r %%f in (*.wpd) do (
soffice.exe -headless -convert-to docx:"MS Word 2007 XML" -outdir "S:\Temp\Ale" %%f)
Like @aschipfl said, go to the directory of each file and then do the conversion:
setlocal enableDelayedExpansion
set "path=%path%;C:\Program Files (x86)\LibreOffice 5\program"
for /r %%f in (*.wpd) do (
pushd %%~dpf
soffice.exe -headless -convert-to docx:"MS Word 2007 XML" "%%f"
popd
)
endlocal