This is simple but handy command to add LoginItems (items that are executed after the user logs in) via the command line using the default tool. To add a normal startup item, use this syntax:
defaults write loginwindow AutoLaunchedApplicationDictionary -array-add \
'<dict><key>Hide</key><false/><key>Path</key><string>/path/to/item</string></dict>'
Of course, replace /path/to/item with the absolute path to whatever it is you want to open. Also, if you want the opened thing to hide itself when it opens, just change the word false, after the Hide key, to true. That's all there is to it.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20050316020738829