Running LibreOffice from cmd line only works when running from c:/program files/

Our system: Windows Server 2008 R2 Standard service pack 1; 64 bit

LibreOffice version: (x64)

Running program on a cmd window works if we go to the “program files” directory; the program comes up:

C:\Program Files\LibreOffice\program> soffice.exe --writer d:/dirpath/test.docx

It does not work when the program is invoked from another directory:

d:\dirpath> c:/“Program Files”/LibreOffice/program/soffice.exe --writer test.docx

This is the error displayed:

Problem signature:

Problem Event Name: APPCRASH

Application Name: soffice.bin

Application Version:

Application Timestamp: 5d67ce73

Fault Module Name: sal3.dll

Any ideas how to fix this?

Thank you very much in advanced.

You use obscure and unusual syntax of quoting only part of the path; and while the advice by @keme will make it all work, this is still a (low-profile) bug of not supporting this rare valid syntax. Please file it to the bug tracker. Thanks.

Ah no, I was wrong. This is not a LibreOffice bug; this is a bug of MS Windows, and possibly of its command processor. When you launch a program using a command line like c:/"Program Files"/LibreOffice/program/soffice.exe --writer test.docx, the quotes get escaped by the processor; the program’s main() gets the first argument like C:/\Program Files/LibreOffice/program/soffice.exe; and calling Windows’ own CommandLineToArgvW(GetCommandLineW()) also gives wrong results, so the first two arguments become C:/\ and Program Files/LibreOffice/program/soffice.exe…, so no, just don’t use that syntax, as @keme advised.

Thank you Mike. It is always good to know how things work “in the background”. Appreciated it.

Treat each path + filename as one entity, which needs to be quoted when it contains spaces:

 "c:/Program Files/LibreOffice/program/soffice.exe" --writer test.docx

Thank you very much Keme. That works.