This a specification of my previous question (What's a .desktop file?) where I wondered how to create a .desktop file in order to create an icon on the launcher for a Wine application.

I don't understand what do we have to do with the following code:

[Desktop Entry]
Comment=Foo & Bar
Exec=sh -c "cd /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER; wine foobar.exe"

Replace USER and FOOBAR_FOLDER with appropriate values. So you'll be able to locate your application in the Launcher by typing "FooBar".

This is the top answer given to a question similar to my previous one, which you can see here: How does one create a custom application launcher for Wine installed apps?, but I don't understand how shall I handle the code I just provided. I tried to copy and paste on the terminal, but it wouldn't work.

In other words, I need that same answer but more comprehensively explained and easier to understand since I don't get what to do with the code provided! Please note, I have few skills with computers. Thank you very much! :)

  • Maybe somewhat related to askubuntu.com/q/47775/250556 Mar 23, 2017 at 3:09
  • I now find (16.04.2 LTS with the Albert launcher) that I need to escape the path space differently: not /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER;, but like this: /home/USER/.wine/drive_c/Program\\\\ Files/FOOBAR_FOLDER;. I.e., four back-slashes before the space. Not sure why, but it works!
    – Dɑvïd
    Apr 21, 2017 at 9:59

2 Answers 2


Desktop files contain a command to open an application. It is not much more than a textfile, with the extension ".desktop". Although you can store these files anywhere, and run it as a standalone link to an application (that is: if you make it executable), the default locations are:


(globally) or



What you need to do is paste the text in your post into an empty textfile (open gedit), and change the line:

Exec=sh -c "cd /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER; wine foobar.exe"

What do you need to change?

Explanation of the sections of the line:


This means: what comes after this will be executed if the desktop file is invoked. That is actually what would make the application start if you would run it in a terminal.

sh -c "cd /home/USER/.wine/drive_c/Program\ Files/FOOBAR_FOLDER;

this is telling the shell to go into the directory where the application is located (the backslash in /Program\ Files is to escape the space in the name of the Program Files folder, telling the shell not to stop at the space).

You should replace USER with your own username, replace FOOBAR_FOLDER with the name of the application folder. If you don't know, open your home directory, press ctrl+h to make the .wine folder visible (if it isn't already), and browse into the directory ~/.wine/drive_c/Program Files to see the name of your application folder.

wine foobar.exe

This tells the shell to run foobar.exe with Wine. Replace foobar.exe with the actual application_name.exe.

Finally, your Exec= line should look something like (if RedNotebook is your application for example):

Exec=sh -c "cd /home/antortjim/.wine/drive_c/Program\ Files/RedNotebook; wine rednotebook.exe"

Then, after you have changed the line Name=Foobar into a more appropriate name, save the file as (for example) rednotebook.desktop

If you want to use the file as a starter on your Desktop, save it there as renotebook.desktop and make it executable. If you want to run it from Dash, move it into ~/.local/share/applications. After log out and back in, it will be available in Dash. You can lock it to the launcher then.

  • Thank you very much for such a comprehensive answer. I understood what a desktop.file is and how to use the code. I also tried it with Foxit Reader on Wine. I created a desktop file that, when double clicked, launches Wine, but before Foxit does, shuts down. Anyway, I found a launcher for Foxit on Wine in the Dash, probably generated on previous trials. But I experience some issues with it, but I think I should leave them for another question. Again, thank you!
    – antortjim
    Apr 22, 2014 at 18:44
  • Just a remark: Desktop Launchers do not need to be executable, as they are no shell nor code. They are just interpreted.
    – Antonio
    Oct 13, 2015 at 23:24
  • @Antonio That is not correct. They do need to be executable if you use them on your desktop as a double- click item. Not if you use them in Dash from ~/usr/share/applications or ~/.local/share/applications Oct 14, 2015 at 6:48

A .desktop file is a text file. You have to open a text editor, like Gedit and paste the content and save it.

You must log in to answer this question.

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