Adding a file to the list of startup applications

Solution 1:

I assume that you use Unity, however the process is quite similar with other Desktop Environments aswell.

Open the Dash and search for:

startup application

Click add and specify the command you'd like to use. You can then use two approaches, either you open the file by selecting the application you'd like to start with the file as an parameter, or you can use xdg-open as mentioned in this askubuntu-thread:

xdg-open [/path/]filename

Solution 2:

You may drag files to be executed at startup into ~/.config/autostart
However, they must be shortcuts (*.desktop files)
If you want to start scripts or documents,
put them in subfolders scripts and documents that you create inside autostart
and create the following shortcuts in autostart:

scripts.desktop:

[Desktop Entry]
Name=Scripts in 'scripts' folder
Exec=/bin/bash -c 'for f in ~/.config/autostart/scripts/*; do eval "$f&"; done'
Type=Application


documents.desktop:

[Desktop Entry]
Name=Documents in 'documents' folder
Exec=/bin/bash -c 'for f in ~/.config/autostart/documents/*; do eval "xdg-open $f&"; done'
Type=Application

Ubuntu ought to be bright enough to allow any .desktop, script, executable or document file to be put in autostart and execute it appropriately.