For example, I want all avi files to be associated with mplayer in Wine

mplayer /home/user/myvideo.avi

Edit from Oli: I believe this this actually the inverse of what most people would assume from the original title. Unless I'm mistaken the user is using Total Commander in Wine and would like to launch a Linux-native player on the path. If I'm wrong, just rollback this edit.

1 Answer 1


The Wine page has some detail on this.

First you need winepath to translate the path. This will make the script and give it permission to run:

mkdir -p ~/bin/
echo '#!/bin/sh' > ~/bin/run_linx_program
echo '$1 "`wine winepath -u "$2"`"' >> ~/bin/run_linx_program
chmod a+x ~/bin/run_linx_program

Then you'd save something like this to a file called association.reg:

"Content Type"="video/x-msvideo"
@="/bin/sh run_linx_program mplayer \"%1\""

Then run regedit association.reg to add the association to Wine's registry.

Note: this is adapted from the Wine page. I got the mime-type from within Linux (file --mime-type an_avi.avi). Wine may treat AVI files differently.

  • ... or use @="c:\windows\system32\winebrowser.exe \"%1\"" as the command. Its a wine builtin that translates the path and launches the file using xdg-open. So, provided that mplayer is already configured outside wine to handle avi files, its a more generic solution (and no scripting or sudo needed)
    – MestreLion
    Commented Jun 30, 2011 at 22:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .