Wine File Associate to Linux

Sometimes we may meet this kind of problem that the file manager told you the error message “Windows programs that open this file was not found(找不到打开此类文件的windows程序)” when you open a file under wine file manager. How to solve this problem? Just make the wine file types associate to linux’s file type.

Here is a shell script to generate registry setting file named filetype.reg under directory /tmp for wine.

filetype="zip rar 7z gz bz2 xz pdf doc docx xls xlsx ppt pptx"
echo > /tmp/filetype.reg
for i in $filetype
    cat << EOF >> /tmp/filetype.reg
"Content Type"="application/$i"
@="winebrowser \"%1\""

echo $i ok

As you can see, the shell script above can only associate file type “zip,rar,…,pptx” and so on, if you want more file type, just add it.

Save the script and run it, you could get the /tmp/filetype.reg registry file. And then just run wine regedit and import the registry setting file. How to open wine regedit ?

$ regedit

Of course, If you have a specific wine directory of configure, you need to specific WINEPREFIX and WINEARCH environment variable, such as:

$ export WINEARCH=win32
$ export WINEPREFIX=`~/.wine_office`
$ regedit

NOTE: if you are using Wine QQ, it is a convenient way to open file directly.

This entry was posted in LINUX and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.