In a .desktop file, what is the "%U" variable?

Solution 1:

When the program is launched the file manager or program launcher will expand the %u with a single URL or file path of the thing you are trying to open.

See the Freedesktop.org Desktop Entry Specification for other codes that you can use in a .desktop file.

Solution 2:

From Ubuntu documentation:

Notice the %U used in the .desktop file above. It is used so as the application to be able to accept an argument when dragging and dropping a file inside the Unity bar on the left. Without it, the program will launch itself, but the argument will not be passed to it and it will be just the same as clicking the application so as to launch.