See BOL. Search the index for SET SHOWPLAN. You will find various options.
See SQLCMD for command line execution.
Combine the two and you're golden.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?