Ask Your Question
0

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

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

jmbauza gravatar image

Our system: Windows Server 2008 R2 Standard service pack 1; 64 bit
LibreOffice version: 6.3.0.4 (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: 6.2.7.1
Application Timestamp: 5d67ce73
Fault Module Name: sal3.dll

Any ideas how to fix this?
Thank you very much in advanced.

edit retag flag offensive close merge delete

Comments

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 +0100 )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 +0100 )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 +0100 )edit

1 Answer

Sort by » oldest newest most voted
2

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

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

Comments

Thank you very much Keme. That works.

jmbauza gravatar imagejmbauza ( 2019-10-23 16:06:09 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 47 times

Last updated: Oct 23 '19