The -a (or --args) option on the bottles CLI is not passing the arguments to the selected program

Hi. This is my first post in the Bottles forum.

I’ve determined that the -a (or --args) option on the bottles CLI is not passing the arguments to the selected program (on my machine).

Here’s what I did:

1 - Running Kubuntu 22.04, Bottles 2022.10.14.1 with Flatpak

2 - Created bottle running sys-wine-7.0 and installed Office 2007 (only Word, Excel, PowerPoint) under Windows 10 (also did Windows 7)

3 - Used Flatseal to give the bottle access to /home/eduardo/Downloads/ (although I’m pretty sure it already had access)

4 - Everything seemed to work perfectly, i.e. running the programs, putting them on the desktop and on the Application Launcher, running them from there, etc.

5 - Then I wanted to do the file association, so that I could start those programs by clicking on the respective files in /home/eduardo/downloads. So I went and added -a to the end of the application start command, like this:

flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Office2007' -p WINWORD -a

This results in Word opening with the default blank “Document 1”.

6 - I started searching and reading forum entires. Only one discussion had useful information (here), although multiple people have asked for help on file associations before. That discussion led me to try

flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Office2007' -p WINWORD -a %F

flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Office2007' -e "/home/eduardo/.var/app/com.usebottles.bottles/data/bottles/bottles/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE" -a

flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Office2007' -e "/home/eduardo/.var/app/com.usebottles.bottles/data/bottles/bottles/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE" -a %F

… all of which have the same result - Word opens, but ignores the file.

7 - Then I went to “Change launch options” for the WINWORD program inside the Bottle, and added the following to Command arguments:
\home\eduardo\Downloads\MyTestFile.docx
… and now I was able to start Word with the file, from everywhere - the “play” button in Bottles, the applications launcher, and by clicking on the .docx file.

8 - I want to note here the mandatory escaping of the backslashes in the Bottle argument - \xyz\xyz\etc will find the file, but no other combination of backslashes or forward slashes will - which, if you ask me, is not very smart. If I input a valid path in the arguments field, I would expect Bottles to translate it to whatever syntax is needed to send a valid path to the Windows app.

9 - I then went back and ran the CLI start command with the -v (verbose) option, and found that in all cases I described above (that result in Word opening but the file argument being ignored), the actual command that was being run was some version of this:

F: Running 'bwrap --args 44 bottles-cli run -b Office2007 -p WINWORD -a /home/eduardo/Downloads/MyTestFile.docx'

… meaning, they ALL had the file path at the end, which looks like it should be a valid syntax.

10 - I then tried the command like this:

flatpak run --command=bottles-cli com.usebottles.bottles run -b 'Office2007' -p WINWORD -a "/safe /t %F"

… to force Word to open in safe mode. Nothing. But when I included /safe as a command argument in Bottles, it did cause Word to start in safe mode.

CONCLUSION:
Based on this, I am forced to conclude that:
a. There’s nothing wrong with my Bottles setup, my Bottle configuration, or my file association calling the Bottles CLI - otherwise I would not be able to open Word (albeit with a new doc) by clicking on the docx file in Linux.
b. I can send different arguments to Word, including a path, via the command argument field in the Bottles configuration, and it gets passed to Word and processed correctly.
c. Using the -a option in the CLI command does NOT pass the argument to the program.

Can anyone please shed some light on this? Am I missing something obvious and stupid here?

Rgds
Ebaldino

Hi. Welcome to Bottles forum.

Overall I don’t think I have good news for you, because I suspect Bottles currently has problem with spaces in names and probably also with passing arguments.

As you can see they both are still open and one of them couldn’t get reproduced.

One thing I can suggest is to maybe move the microsoft office to a new folder directly in “drive_c” folder. It would get rid of 2 folders with spaces which could help with bottle-cli, but I don’t know if it would help and even if office will work in a custom folder.

Please be sure to post your findings if you decide to follow this attempt.

Hi, zakapslowany.

Thank you so much for the reply.
Yes, Bottles needs to fix the CLI argument thing, as it’s got a few holes.
For my part, I determined that my problem was that forward slashes needed to be converted to backslashes on the paths, and then that the backslashes needed to be escaped twice. So I pre-processed the %F argument with a sed command and got it to work.

I’m writing up my solution and will post it as a separate forum entry, as it may help other people.
My specific solution won’t fix the case of path names with spaces, but I just avoid those, so it’s not a big deal for me.

I just posted the solution here.

But thanks again for your support.
Cheers.

Made with ❤️ by Bottles Developers.

proudly hosted by



Privacy Policy