Ask Your Question

Running LibreOffice from cmd line only works when running from c:/program files/... [closed]

asked 2019-10-23 00:06:12 +0200

jmbauza gravatar image

updated 2021-05-17 23:34:27 +0200

Alex Kemp gravatar image

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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-05-17 23:34:38.894300


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.

Mike Kaganski gravatar imageMike Kaganski ( 2019-10-23 06:54:40 +0200 )edit

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.

Mike Kaganski gravatar imageMike Kaganski ( 2019-10-23 10:18:40 +0200 )edit

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

jmbauza gravatar imagejmbauza ( 2019-10-23 16:09:23 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-10-23 00:17:47 +0200

keme gravatar image

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
edit flag offensive delete link more


Thank you very much Keme. That works.

jmbauza gravatar imagejmbauza ( 2019-10-23 16:06:09 +0200 )edit

Question Tools

1 follower


Asked: 2019-10-23 00:06:12 +0200

Seen: 628 times

Last updated: Oct 23 '19